- Home /
Question by
themrgman142 · Nov 28, 2013 at 05:15 AM ·
javascriptloadlevelvar
Can you use a var to load a level?
I'm trying to make a level loading capsule that will load the next level. But to do this with my current script I have to rewrite it and make a new script to load a different level.
function OnTriggerEnter (info : Collider)
{
if (info.tag == "Player")
{
Application.LoadLevel("Level Name Here");
}
}
I was wondering if there is some way to use a var to load the level instead of rewriting the script. Thank You!
Comment
Best Answer
Answer by AlucardJay · Nov 28, 2013 at 06:19 AM
var levelToLoadString : String = "Level Name Here";
function OnTriggerEnter (info : Collider)
{
if (info.tag == "Player")
{
Application.LoadLevel( levelToLoadString );
}
}
Answer by qwertyk31 · Nov 28, 2013 at 07:28 AM
I beleve it is something like this
function OnTriggerEnter (info : Collider)
{
if (info.tag == "Player")
{
Application.LoadLevel(1++);
}
}
This should load the next level
Your answer
Follow this Question
Related Questions
Restart game script. 1 Answer
i need help making a log in system 0 Answers
Current scene number 2 Answers
how to load random level but one? 3 Answers
Loading bar with visual bar 1 Answer