Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[SOLVED] Switching scenes and camera management

Discussion in 'Getting Started' started by egartnuc, Jun 7, 2018.

  1. egartnuc

    egartnuc

    Joined:
    Jun 2, 2018
    Posts:
    23
    Hi,

    So I'm totally new at this, been doing some simple coding before but is all new to the Unity Engine. And still with what I produced just with the help of tutorials and hard work in a few days makes me quite satisfied, the Unity Engine is indeed a powerful tool. So let's get to my problem. Obviously this noob needs some help. ;)

    I started working on a main menu, something that pops after splash screen and in which I select "New game" or "Quit". And when I select "New Game" I'd like to switch to another scene which is the game itself and a camera with standard asset FPSController.

    Problem 1: As soon as I add the standard asset FPSController into the 2nd scene, when I press play it begins on that camera, in the actual game scene, instead of with the main menu camera. Has anyone else experienced this? I assume it's a beginners error, but hopefully someone can give me some hints anyhow. :)

    Problem 2 (less serious, but thought I might as well ask): The main menu buttons and images etc are visible from inside the game when I load into my character. How do I hide them?

    I appreciate any help, hints or being pointed to a proper direction.

    Cheers,

    TL
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,187
    Problem 1 is not a problem. When you hit Play, Unity plays the current scene. That's a feature. If you want to test how your game plays from the main menu scene, switch to the main menu scene and hit Play. Or build it, and test it that way.

    As for Problem 2, you merely need to deactivate the main menu object at the appropriate time. You can probably do that directly from whatever Unity event should cause it to happen (a button On Click event for example), or you can do it from code by calling theObject.SetActive(false), where theObject is a reference to the root of your main menu hierarchy.
     
    Tset_Tsyung likes this.
  3. egartnuc

    egartnuc

    Joined:
    Jun 2, 2018
    Posts:
    23
    How did I not realize this before through my trial and error.

    Thank you for your reply, @JoeStrout - right you were. Much appreciated, and a good first experience of engaging in this forum.

    Take care.
     
    JoeStrout and Tset_Tsyung like this.