Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to set an active camera in a new scene?

Discussion in 'Editor & General Support' started by Startec, May 3, 2019.

  1. Startec

    Startec

    Joined:
    Nov 10, 2015
    Posts:
    12
    I am loading a scene with
    Code (CSharp):
    1.         SceneManager.LoadScene("SampleScene");
    this loads 8 new cameras.

    How do I set one of those cameras to be active? I can't reference it and do something like:
    Code (CSharp):
    1.         var cam = GameObject.Find("Camera 1");
    2.         cam.SetActive(true);
    because the camera does not exist yet.


    Thanks
     
  2. dmennenoh

    dmennenoh

    Joined:
    Jul 1, 2015
    Posts:
    379