Last active
December 21, 2015 15:49
-
-
Save is8r/6329157 to your computer and use it in GitHub Desktop.
任意のGameObjectやプログラムを探す
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//FindWithTag | |
GameObject xxx = GameObject.FindWithTag("xxx");//single object, InspectorのTagに表示されている名称 | |
xxx.SendMessage("action"); | |
xxx.BroadcastMessage("action"); | |
//FindGameObjectsWithTag | |
GameObject[] xxxs = GameObject.FindGameObjectsWithTag("xxx");//any objects, InspectorのTagに表示されている名称 | |
foreach(GameObject xxx in xxxs) | |
Debug.Log(xxx); | |
//Find | |
GameObject xxx = GameObject.Find("/Actor/Xxx");//Hierarchyに表示されている名称 | |
Debug.Log(xxx); | |
//GetComponent | |
XxxController xxxController = xxx.GetComponent<XxxController> (); | |
Xxx xxx = GetComponent <Xxx> (); | |
Xxx xxx = GetComponentInChildren <Xxx> (); | |
Text xxx = GetComponent <Text> (); | |
Animator xxx = GetComponent <Animator> (); | |
AudioSource xxx = GetComponent <AudioSource> (); | |
//FindObjectOfType | |
XxxController xxxController = FindObjectOfType<XxxController> (); | |
//RequireComponent | |
[RequireComponent(typeof (XxxController))] | |
public class GameController : MonoBehaviour { | |
private XxxController xxxController; | |
void Start () { | |
xxxController = GetComponent<XxxController> (); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment