public static SceneCamera UF_CreateToMainCamera() { SceneCamera ret = Camera.main.GetComponent <SceneCamera>(); if (ret == null) { ret = Camera.main.gameObject.AddComponent <SceneCamera> (); } main = ret; return(ret); }
public static SceneCamera UF_CreateToGameObject(string objName) { GameObject obj = GameObject.Find(objName); SceneCamera ret = null; if (obj != null) { ret = obj.GetComponent <SceneCamera>(); if (ret == null) { ret = obj.gameObject.AddComponent <SceneCamera> (); } } //默认第一个作为主 if (main == null) { main = ret; } return(ret); }