Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Open another Scene in a UI-Element

Discussion in 'Scripting' started by BahamutNeo, Apr 16, 2021.

  1. BahamutNeo

    BahamutNeo

    Joined:
    Apr 2, 2016
    Posts:
    5
    Hello
    I need help to make the follow situation with 2 scenes at the same time.

    I have 3 "Overworld"-Scenes in which the character can move.
    And I have a Scene D that can be called in the player menu.
    The camera view of the fourth scene should be visible in a UI element as in the following figure.
    upload_2021-4-16_6-38-40.png

    How can I do that?
    The scene D with his objects should not appear in the "Overworld"-scenes. (no Overlap)
    I want 2 different scenes with an own camera.
    This camera-sight should be visible on a UI-Element.
    (Both scenes are independently and active at the same time after the call from the menu)

    How can I show the camera image of scene D on the UI element?

    How can I open a new scene at the same time without overlapping ?

    look forward to your help,

    greetings

    andy
     
    Last edited: Apr 16, 2021
  2. BahamutNeo

    BahamutNeo

    Joined:
    Apr 2, 2016
    Posts:
    5
    *edited*
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    Do you mean keep all these scenes running at once? That is totally possible but will require you to organize them in a way that lets you:

    - load them all concurrently (either positionally offset or else layers-offset)

    - easily control and enable/disable the cameras coming from each one, as well as adjust their rectangles and layering

    Iterate, start small, try to get a second scene running and overlay its camera in a first scene. It's totally doable, it just requires a lot more setup and connections to maintain.
     
  4. BahamutNeo

    BahamutNeo

    Joined:
    Apr 2, 2016
    Posts:
    5
    Thanks for your answer, but I meant it differently:

    I explain it more simply:

    I wanted to load 2 different scenes at the same time.
    they run in different "coordinate areas" (= independent coordinate area / spaces)
    (= The objects in should stay in their original scenes and not appear in the other scene.)

    And I want the camera view from the camera in the second scene on a UI element in the first scene
     
  5. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    9,915
    You can load your scene additively (keywords: LoadSceneAsync + LoadSceneMode.Additive)
    You can have everything in the additive scene on a particular layer. Your second camera can set to render only that layer and to a RenderTexture, your main camera should exclude that same layer, so the things in the second scene won't show up.
    That RenderTexture then can be projected on a RawImage component.

    Be careful, this method can be costly in terms of resources.
     
    Kurt-Dekker and BahamutNeo like this.
  6. BahamutNeo

    BahamutNeo

    Joined:
    Apr 2, 2016
    Posts:
    5
    Thank you,
    that's a good idea :)
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    Ah yes, even easier, and as Lurking says above, additive scene loading is your friend, then layered cameras.

    You can perhaps see considerations for this by looking up "security camera" tutorials. That lets you even put the distant scene onto the front of a diagetic object, such as a television monitor in your current scene.
     
    BahamutNeo likes this.