- Home /
Random level select
Hi, guys! I've started to learn Unity 3D recently and now I have a question: I want any of 5 levels to start with the launching of game.
I've found the code:
Application.LoadLevel(Random.Range(1, 4));
But I don't know where to put it. I tried to do this:
using UnityEngine;
using System.Collections;
public class App : MonoBehaviour {
void Start () {
Application.LoadLevel(Random.Range(1, 4));
}
void Update () {
}
}
But after "Build and run" application starts the first level :( What am I doing wrong? Thanks!
Comment
Best Answer
Answer by Graham-Dunnett · Jan 04, 2013 at 11:48 AM
Just let Unity always start with level 1. Have that as a splash screen, or something that lets the user know the game has loaded. Then use your code to got to a level 2..5.
Your answer
Follow this Question
Related Questions
How the scene works 1 Answer
Multiple Instances of My Current Scene? 0 Answers
Current scene number 2 Answers
How can I save the player's progress in-game? 1 Answer
How to see what level is running? 2 Answers