- Home /
LoadLevelAdditive to load consecutive levels, levels loaded multiple times
I am trying to load some levels by mouse click(i use Cardboard SDK) using LoadLevelAdditive. The problem is that each time the next level is loaded, the previous levels are reloaded. I assigned the following script to each object in each level.
public class Change : MonoBehaviour
{
int i = 0;
GameObject target;
//Update is called once per frame
void Update()
{
//int i = Application.loadedLevel;
LVL();
}
void LVL()
{
if (Cardboard.SDK.Triggered)
{
i++;
if (i < 6)
{
string name = string.Format("SU_{0}", i);
Application.LoadLevelAdditive(name);
//Destroy(GetComponent(name));
}
else
{
if (i >= 6 || Application.loadedLevelName == "su_5")
{
Application.LoadLevel("su_0");
i = 0;
}
}
}
}
}
screen-shot-11-04-15-at-0334-pm.png
(297.9 kB)
Comment
Your answer
Follow this Question
Related Questions
Application.LoadLevel sometimes loads the wrong scene 0 Answers
How to manage multiple levels in the 2D game ? 3 Answers
How do I change scenes from triggers in UNity 1 Answer
Unity game level design patterns 0 Answers
How to add multiple levels? 3 Answers