Put this as a method variable
// C# public Transform prefabMovePath;
Once you have that method variable in your Unity script, then you will see this.
Simply drag and drop the prefab you want to the script to instantiate to the PrefabMovePath in unity.
Use this Instantiate code to create an instance of that prefab.
private Transform curMove; void Start() { curMove = (Transform)Instantiate(prefabMovePath, new Vector3(0, 0, 0), Quaternion.identity); }
Then, since that prefab has a script I need access to, use this when wanting to call code in the script that prefab is attached to.
MovePath mp = curMove.GetComponent
(); mp.rotateLeft();
No comments:
Post a Comment