====== 오브젝트 선택 or 컴포넌트 선택 ====== 웹 레퍼런스 * [[http://docs.unity3d.com/Documentation/ScriptReference/index.Accessing_Other_Components.html|Overview: Accessing Other Components]] * [[http://docs.unity3d.com/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html|Overview: Accessing Other Game Objects]] ===== 다른 게임 오브젝트의 컴포넌트나 스크립트 사용 ===== public class example : MonoBehaviour { void Example() { transform.Translate(0, 1, 0); GetComponent().Translate(0, 1, 0); } } public class example : MonoBehaviour { void Update() { otherScript = GetComponent(); otherScript.DoSomething(); } } ===== 게임 오브젝트 찾기 ===== * 찾기 귀찮으면 스크립트에서 게임 오브젝트를 파라미터로 받는 방법이 편한듯. public class example : MonoBehaviour { void Start() { GameObject go = GameObject.Find("SomeGuy"); go.GetComponent().DoSomething(); GameObject player = GameObject.FindWithTag("Player"); player.GetComponent().DoSomething(); } }