I’m quite new to Unity, and so thought I would start blogging useful things that I’ve discovered. Obviously, there is the
In my particular example, I have a game, whereby touching a specific object progresses to the next level. Here’s the code (against the target object):
void OnCollisionEnter() { if (Application.loadedLevel < Application.levelCount) Application.LoadLevel(Application.loadedLevel + 1); }
I admit, it’s not exactly rocket science, but it took me a while to work this out. I spent some time trying to parse the level name, and other workarounds, before I spotted that it’s all in the Application object.