[Solved] Can I change scene to one of two (or more) options?

Basically, I want to make it so that when I change scenes on certain levels, the player will either go to one scene or the other. So let’s say the player just finished a scene, and after they’re done, they will go to either scene number 3 or scene number 4.
Right now I can only choose a single scene from my list of scenes.

Do you mean depending of a condition go to one scene or another? or a random scene from a list?

I mean that I want the scene to change to a random scene out of two or more options.

  1. Create Array Variable to store all of your scene names maybe global variable

    Add the children to the array according to the name of scenes you want

  2. Make an event to change scene
    (For my example I created a box when clicked it changes scene)

on Action select Change the scene then click on expression



It will random the number from 0 to the number of scene in your array minus by 1 because array first index is 0

I tested it and it changed scene hope it works on yours


This should also work

FYI: The key to all of these approaches is clicking the Use an expression button. Then you can use an expression like random or a variable instead of the dropdown list.

So I tried doing it your way, and it said that no variable with this name was found. I don’t know if I maybe did something wrong?

First, you need to put scene names in that array. You have two array items and both have value of “0”. They have to contain scene names.

Second, if you named your variable differently than in example above, you need to change it everywhere:


That worked! Thanks!

1 Like