How to send a message across different scenes

I have a script in Unity which lets me load scenes randomly once the user presses on the “Next Button” in scene 0, which in turn loads a random scene (be it scene 1 or scene 2). Now, each scene has its own next button which (theoretically) sends a message to the SceneManager script that is attached to the mainCamera object in scene 0 to loads the next random scene.

But the reality is that, while it is loading random level from scene 0 the first time, when I get to either scene 1 or 2 and hit the next button it doesn’t load, it just stops after I hit the button.

Now, here is the script I have attached to the mainacmera object in scene 0:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class myDefaultScene: MonoBehaviour
    public static bool userClickedNextButton;

    protected const int MAX = 2;

    private List<int> scenes = new List<int>();

    void Start()
        scenes = new List<int>(Enumerable.Range(1,MAX)); // This creates a list with values from 1 to 2
        cs_completionWindow = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<TestCompletionWindow>();

    void Update()
        if (userClickedNextButton)
            if (scenes.Count == 0)
            // Get a random index from the list of remaining level 
            int randomIndex = Random.Range(0, scenes.Count);
            int level = scenes[randomIndex];                         
            scenes.RemoveAt(randomIndex); // Removes the level from the list 
            userClickedNextButton = false;

Here is the command I have in my other scenes to send the message to the scene0:

public void myMethod()
//CODE goes here
case Windows.nextReferentTask:
                myDefaultScene.userClickedNextButton = true;

Maybe you want to attach the SceneManager object to all scenes, not just scene0. Keep in mind, that when you load a scene, the previous scene is unloaded from memory, so all the objects and scripts in the old scene are no longer running. You can’t actually send a message to an object in another scene, but what you can do, is load another scene and pass some information to it. But remember that the other scene will only use this information after it is loaded.

The trick to do that, is define an object that remains between scenes, and is not destroyed when you switch scenes. You can do that by calling the DontDestroyOnLoad. All you have to do is run the command in the object’s start method:

void Start() {

Now this object will be kept between scenes, and you can use this object to pass messages between scenes.

For your case, it seems like one of two methods will work best: Either keep your SceneManager between scenes (with the method described above), or have a different SceneManager in every scene.

@Tomer-Barkan What if I used asyncload in additive mode? I figured since from main menu each one from 3 scenes can be loaded, it’s better to use additive mode to preload all 3. But then I need these scenes to be inactive so they will not interfere with the Main Menu scene, so each scene is now a component in it’s own parent “SceneHolder”, which is inactive.
So now remains the question - which is the best way to activate the SceneHolder when a specific scene is chosen?
Or would you do it completely different?