HotPatchUnityGenericReferences.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using UnityEngine;
  2. using UnityEngine.Scripting;
  3. namespace HotPatch
  4. {
  5. [Preserve]
  6. internal static class HotPatchUnityGenericReferences
  7. {
  8. #if UNITY_IOS
  9. [Preserve]
  10. static System.Type PreserveIosSupport() => typeof(Unity.Advertisement.IosSupport.ATTrackingStatusBinding);
  11. #endif
  12. [Preserve]
  13. static void Preserve(GameObject go, Component component)
  14. {
  15. go.AddComponent<Component>();
  16. go.GetComponent<Component>();
  17. go.GetComponentInChildren<Component>();
  18. go.GetComponentInChildren<Component>(true);
  19. go.GetComponentsInChildren<Component>();
  20. go.GetComponentsInChildren<Component>(true);
  21. component.GetComponent<Component>();
  22. component.GetComponentInChildren<Component>();
  23. component.GetComponentsInChildren<Component>();
  24. component.GetComponentsInChildren<Component>(true);
  25. Object.FindAnyObjectByType<Object>();
  26. Object.FindFirstObjectByType<Object>();
  27. Object.Instantiate<Object>(go);
  28. Resources.Load<Object>("");
  29. Resources.LoadAll<Object>("");
  30. JsonUtility.FromJson<object>("{}");
  31. }
  32. }
  33. }