i wanted to link my levels together like if you go into a hole it will bring you to the next level how would i be able to accomplish this
i was thinking about using triggers but the last time i tried to use them i was not able to get them to work is there a better way to do it
Triggers are the way.
Triggers would be ideal.
var levelToLoad : string;
function OnTriggerEnter (other : Collider) {
if (other.tag == "Player")
Application.LoadLevel (levelToLoad);
}
are your levels separated scenes? or next level is next to this one, but on the same scene?
in both way, I would make hole as object, with collider so when you step on the hole it triggers
just make sure that your hole has “is trigger = true” in collider component, and player should have rigidbody and these codes attached on it:
void OnTriggerEnter(Collider other)
{
if (other.tag == “Hole”) Application.LoadLevel (1);
}
or in other case just move position of player
void OnTriggerEnter(Collider other)
{
if (other.tag == “Hole”) transform.position = new Vector3(x,y,z);
}
thanks for the info i will try them to see which ones will work best for me
yay it works thanks i just had to tweak the code a little to make it work for me though