public T Get <T>() where T : MonoBehaviour { if (null == lastGot || lastGot.GetType() != typeof(T)) { lastGot = UnityObject.GetComponent <T>(); } return((T)lastGot); }
public void AddRigidbody() { if (UnityObject && UnityObject.GetComponent <Rigidbody>()) { return; } AddGameObject(new GameObject(), 0.1f, true);//GameObject.CreatePrimitive(PrimitiveType.Sphere);// }
private void AddCollider() { var collider = UnityObject.GetComponent <MeshCollider>(); if (collider == null) { collider = UnityObject.AddComponent <MeshCollider>(); } collider.sharedMesh = UnityObject.GetComponent <MeshFilter>().mesh; collider.enabled = true; }