This may be hard to understand because this is hard to explain

I have 6 scenes and one 'start' scene.

The start scene will be where my scene manager is.

So I want function where when the player clicks on the the start scene it goes to a random scene (from the 6 scenes) and then it goes to start. Then when you click again it goes to random scene, but this time these random scenes will be between the remaining 5 (excluding the scene the player just went on) and then it goes back to start. Then it goes to a random scene time, this time these random scene will be between the remaining 4. And so one.

I already know how to go a random scene and back but I don't know how to do the remaining

  • 1
    \$\begingroup\$ Have a list with scenes, remove a scene when you visited it? \$\endgroup\$ – ElDuderino Sep 10 '16 at 9:23
  • \$\begingroup\$ @ElDuderino How do I do that? \$\endgroup\$ – AJ123 Sep 10 '16 at 9:55
  • 2
    \$\begingroup\$ @AJ123 Are you familiar with the C# List class? \$\endgroup\$ – Philipp Sep 10 '16 at 10:18

you can use simple a simple list in C# to accomplish that

Suppose you are using the SceneManager.LoadScene() with the scene name overload, you can just store the six scene names in a C# list in a controller on your main scene

List<String> list = new List<String>();
list.Add(\name of your scene\); 

And then on detection of a mouse click you could just do

int i = Random.Range(0,list.count-1);

this will ensure that no scene will be loaded twice


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.