- Home /
Change scenes from area?
Greetings, I would like to know if anyone knows how to make it so a the player changes scenes after entering a certain radius. I am planning on using this on my current game so that it changes scenes when the player walks into the end of the level area so it can switch to the next level scene. Thank you!
Answer by Phoskryfes · Oct 30, 2012 at 04:01 AM
If you get to the desired platform, you will go to the other scene. If that is your question, insert this to that platform. Make a tag for your player named "Player". Also set your platform into trigger. Put the name of the scene in the LevelToLoad. Also, include the scene in your build and run settings.
var target: Transform;
function OnTriggerEnter(other:Collider){
Debug.Log("Trigger is on");
if(other.gameObject.tag =="Player"){
Debug.Log("I am here ");
Application.LoadLevel("LevelToLoad");
}
}
Could you accept my answer by pressing the check button at the left side of my answer?
press your player, you would then see a "untagged" at the top of the inspector tab. press that then press add tag. Go to the element then type "Player". then put your player a tag named "Player". Big P because it's case sensitive. Then put the script I wrote to the platform.
If you have anymore questions, add me on FaceBook.