示例#1
0
 public T Get <T>() where T : MonoBehaviour
 {
     if (null == lastGot || lastGot.GetType() != typeof(T))
     {
         lastGot = UnityObject.GetComponent <T>();
     }
     return((T)lastGot);
 }
示例#2
0
        public void AddRigidbody()
        {
            if (UnityObject && UnityObject.GetComponent <Rigidbody>())
            {
                return;
            }

            AddGameObject(new GameObject(), 0.1f, true);//GameObject.CreatePrimitive(PrimitiveType.Sphere);//
        }
示例#3
0
        private void AddCollider()
        {
            var collider = UnityObject.GetComponent <MeshCollider>();

            if (collider == null)
            {
                collider = UnityObject.AddComponent <MeshCollider>();
            }
            collider.sharedMesh = UnityObject.GetComponent <MeshFilter>().mesh;
            collider.enabled    = true;
        }