예제 #1
0
 // Start is called before the first frame update
 void Start()
 {
     scriptToFind = GetComponent <ScriptToFind>();
     // this one will search the object for attached scripts
     scriptToFind = FindObjectOfType <ScriptToFind>();
     // this one will search the object transform referance for the
     // script that it is attached to
     scriptToFind = objectTransform.GetComponent <ScriptToFind>();
     // this one will find the first instance of the script
 }
예제 #2
0
 // Start is called before the first frame update
 void Start()
 {
     scriptToFind = GetComponent <ScriptToFind>();                 // this one will search the object that THIS script is attached to.
     scriptToFind = objectTransform.GetComponent <ScriptToFind>(); // this one will search objectTransform reference for the script that it is attached to
     scriptToFind = FindObjectOfType <ScriptToFind>();             // This one will find the first instance of the "ScriptToFind" script.
 }