Access components of a scene from another scene

0

In a game I'm doing, I have two scenes defined:

1.- start : has several panels, to show a basic options menu (run game, configuration, credits, exit). These panels have 50% transparency

2.- game : The game itself. Among other things, it has 3 cameras that are moving around in different areas of the terrain.

My idea is that every time you change the panel, one of the cameras is activated (random), so that the background is the animation that the camera makes.

At the moment I have a GameManager with a function that I call every time I press one of the buttons:

public void EnableMenu(string menu)
{
    print("GUI items: " + panels.Count);
    foreach (string key in panels.Keys) {
        print("key: " + key);
        panels[key].SetActive(key == menu);
    }
    print("enable menu: " + menu);
}

Each of the buttons calls that function with a different string, with the name of the panel. so this part is doing well. However, I still have to "load" the cameras. For this, in the Start () method I have the following:

    public void Start()
{

    EnableMenu("Menu");
    SceneManager.loadScene("game", LoadSceneMode.Additive);

}

With this I have loaded the second scene additively. But I do not see how I can access the cameras that I have in it. Also, this loads ALL the "game" scene. I would be interested in loading only the parts of the scene with their cameras.

Do I have to make different scenes and load them separately, or could I indicate somehow the loading of part of a scene?

On the other hand, how do I access the cameras of this new scene?

    
asked by Jakala 30.05.2018 в 20:06
source

0 answers