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

Unity UI Cannot link Render Camera in "Screen Space - Camera" canvas if it is set to not destroy on load

Discussion in 'UGUI & TextMesh Pro' started by Dominique0, Jul 27, 2017.

  1. Dominique0

    Dominique0

    Joined:
    Jun 8, 2015
    Posts:
    26
    I have a ui Canvas with the render mode set to "Screen Space - Camera". The gameobject is set to not destroy on load by script (DontDestroyOnLoad()).

    Is there a reason why in this settup, I cannot assign a camera (that is not set to DontDestroyOnLoad) to the Render Camera (WorldCamera) field?
     
    Psyco92 likes this.
  2. Psyco92

    Psyco92

    Joined:
    Nov 15, 2013
    Posts:
    22
    Still an issue in 2019.3.6
     
  3. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,152
    It is the same in 2019.4.18. Is it a bug? Is there any workaround?
     
  4. nntgam

    nntgam

    Joined:
    Mar 9, 2019
    Posts:
    9
    Same with me. It working at 2019.2 but when I upgrade to 2019.4 LTS then it can't assign. I don't know it is a feature or not =))
    To work around this.
    After the scene is loaded then execute this.

    Code (CSharp):
    1.         canvasCamera.transform.SetParent(null);
    2.         SceneManager.MoveGameObjectToScene(canvasCamera.gameObject, SceneManager.GetActiveScene());
    3.         canvasCamera.worldCamera = Camera;
    4.         canvasCamera.transform.SetParent(transform); //move back to don't destroy root or using don'tdestroyonload object
     
    Last edited: Jul 27, 2021
  5. Frizzzer123

    Frizzzer123

    Joined:
    Feb 2, 2021
    Posts:
    11
    Same problem here. Is that a bug or a feature ?