mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
增加DisStripCode防止裁剪组件
This commit is contained in:
55
UnityProject/Assets/Launcher/Scripts/DisStripCode.cs
Normal file
55
UnityProject/Assets/Launcher/Scripts/DisStripCode.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
/// <summary>
|
||||
/// 防止裁剪引用。
|
||||
/// <remarks>如果在主工程无引用,link.xml的防裁剪也无效。</remarks>
|
||||
/// <remarks>最好是AOT显示保留引用,Preserve有可能还会裁成员变量。</remarks>
|
||||
/// </summary>
|
||||
[Preserve]
|
||||
public class DisStripCode : MonoBehaviour
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
//UnityEngine.Physics
|
||||
RegisterType<Collider>();
|
||||
RegisterType<Collider2D>();
|
||||
RegisterType<Collision>();
|
||||
RegisterType<Collision2D>();
|
||||
RegisterType<CapsuleCollider2D>();
|
||||
|
||||
RegisterType<Rigidbody>();
|
||||
RegisterType<Rigidbody2D>();
|
||||
|
||||
RegisterType<Ray>();
|
||||
RegisterType<Ray2D>();
|
||||
|
||||
//UnityEngine.Graphics
|
||||
RegisterType<Mesh>();
|
||||
RegisterType<MeshRenderer>();
|
||||
|
||||
//UnityEngine.Animation
|
||||
RegisterType<AnimationClip>();
|
||||
RegisterType<AnimationCurve>();
|
||||
RegisterType<AnimationEvent>();
|
||||
RegisterType<AnimationState>();
|
||||
RegisterType<Animator>();
|
||||
RegisterType<Animation>();
|
||||
|
||||
#if UNITY_IOS || PLATFORM_IOS
|
||||
/*
|
||||
// IOSCamera ios下相机权限的问题,用这种方法就可以解决了 问题防裁剪。
|
||||
foreach (var _ in WebCamTexture.devices)
|
||||
{
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
private void RegisterType<T>()
|
||||
{
|
||||
#if UNITY_EDITOR && false
|
||||
Debug.Log($"DisStripCode RegisterType :{typeof(T)}");
|
||||
#endif
|
||||
}
|
||||
}
|
11
UnityProject/Assets/Launcher/Scripts/DisStripCode.cs.meta
Normal file
11
UnityProject/Assets/Launcher/Scripts/DisStripCode.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e66799967838b84f8fb02750fb5ad27
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -265,6 +265,7 @@ Transform:
|
||||
- {fileID: 7696541955418391618}
|
||||
- {fileID: 7696541955235861479}
|
||||
- {fileID: 404609667950854598}
|
||||
- {fileID: 5550035055454355162}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -347,3 +348,47 @@ MonoBehaviour:
|
||||
audioSetting: {fileID: 11400000, guid: 397bf671e3302424185ecb93a1b6db02, type: 2}
|
||||
procedureSetting: {fileID: 11400000, guid: ae1b500b4382ce84db5dd66e8c01c0f2, type: 2}
|
||||
updateSetting: {fileID: 11400000, guid: 767d6f38f7fa4b34bb2ae1fc07f58a7f, type: 2}
|
||||
--- !u!1 &8578946418358997677
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5550035055454355162}
|
||||
- component: {fileID: 4615381382982951676}
|
||||
m_Layer: 0
|
||||
m_Name: DisStripCode
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5550035055454355162
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8578946418358997677}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7696541955266276700}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &4615381382982951676
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8578946418358997677}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6e66799967838b84f8fb02750fb5ad27, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
|
Reference in New Issue
Block a user