- Home /
Scene Change Collision
I'm having trouble with a scene change. This is the code I currently have.
pragma strict
unction OnCollisionEnter(other : Collision){ if(other.gameObject.name == "Player"){ Application.LoadLevel("Level1Outside"); }
if(other.gameObject.tag == "Player"){
Application.LoadLevel("Level1Outside");
}
}
I have set the empty object as a trigger, added the script, tried putting the script into both C# and Javascript, put the levels into my build settings, my first person controller is tagged 'Player', nothing god damn works.
Sorry for getting annoyed, but i've been trying to get this right for days, and it's starting to anger me.
~James
Answer by ICHeeryI · Nov 25, 2013 at 10:24 PM
I think you need to add for example box collider to your game object and inside mark ,,is trigger,, then scale box collider so that player can enter it, once the player ,,enter,, it should work. Hope this helped.
Edit: Im not sure about other.gameObject.tag, try using other.tag
The GameObject is trigger, I tried using
other.tag
I tagged everything on my player as "Player" Put both levels into the build settings again, didn't work...
Thanks for your time though. I'll find a way, I'm sure.
Answer by James_Lel · Dec 05, 2013 at 09:33 PM
ction OnTriggerEnter(goalCollision : Collider){ if(goalCollision.gameObject.tag == "Player"){
Application.LoadLevel("OUTSIDE_LH");
}
I found a working one.