I posed this question before but i reckon I posed it in correctly what i would like to do is make this script or the behavour attatched to the script active when the main charector reaches the object Im sure its something very simple but been struggiling for a while
sorry its such a trivual one
var newObject : Transform;
function Start () { //instanniate has to have a start function
while(true){
yield new WaitForSeconds (1);
Instantiate(newObject, transform.position, transform.rotation);
yield new WaitForSeconds (1);
Instantiate(newObject, transform.position, transform.rotation);
gameObject.active = true;
}
}
Create A cube, or import a mesh to act as a trigger zone. Set its mesh collider to trigger. Add this
var node:GameObject;
//Put your Script on that
function OnTriggerEnter (other : Collider) {
if (other.tag == "Player")
node.active=true;
//Tag your FPS Controller in the top of inspector to "Player" to make this work
}
function OnTriggerExit (other : Collider) {
if (other.tag == "Player")
node.active=false;
//YOU MUST Tag your FPS Controller in the top of inspector to "Player" to make this work
}
If it doesnt work, Ive made a spelling mistake or you havent tagged your controller
As per usual think i am overreaching my abilities and need to understand and grasp the tag functions in unity before i try and implement your script
Aaron could you or any off the Uni community point me in the direction of a few decent tutorials I will do a search as well but you guys might come up with something that i overlook
cheers guys
Is there another way to make this code work without creating tags?
not to grips with how to use tags as yet and when I tried to implement targos code Unity the damn snake that it is just threw up error message below
expected : insert a semicolon at the end
Tried to figure out what the issue is regarding semi colon but it looked like the code was fine so thought it must be something else causing the problem