Im reading scripting tut 101 that comes with the Unity documentation, and on page 6, at the end of part 6 there is a paragraph headed
2.Game object Tag
function Update () {
? if (Input.GetButtonDown("Jump"))
? {
? ? var newTarget = GameObject.FindWithTag("Cube").transform;
//This is where Im confused//
? ? GetComponent(Follow).target = newTarget;
}
}
Okay so we have layers and tags.
- How do we get a basic structure here-With layers and tags
<whats actually happening here? Whats a real basic example of using this approach?>
In my scene I have cube and cube1.
2. Is the Game object (in this case" cube") referenced by this script, or is it refering to a tag, or a layer?
- Perhaps someone could give me an example of how to set up a custom layer and a custom tag to go with this script?
And just so I know Im getting it, I’ll call my Game object “tree”.(so I can see where it goes in terms of naming conventions.
ATM I get error: UnityException:Tag Cubeis not defined! when I drag this onto a spotlight within the scene
(Im copying straight from tut doc)
- How and what is defining it?
Thanks team
AC out