using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace GameLogic { public static class GameExtension { public static T AddMissingComponent(this GameObject gameObj) where T : Component { T t = gameObj.GetComponent(); if (t == null) t = gameObj.AddComponent(); return t; } } public static class UnityEngineObjectExtention { public static bool IsNull(this UnityEngine.Object o) // 或者名字叫IsDestroyed等等 { return o == null; } } }