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.

Question How to de-render everything outside of a room while in one?

Discussion in 'Scripting' started by JamieA806, Mar 30, 2023.

  1. JamieA806

    JamieA806

    Joined:
    Mar 30, 2023
    Posts:
    1
    I apologise if the title is a bit confusing, I'll elaborate about what I mean here.

    I am currently developing an isometric game with Unity, and I want my entire game to be sectioned off into "rooms".
    I would like to know how to make it so that when you are inside one "room", the rest of the game de-renders or disappears.(Think like Pokémon, but isometric view, and only 2 walls and the floor are visible along with the objects in the room).
    The idea is to have a brief fade-in fade-out when entering another room to allow the objects and visible walls and floors to render in.

    I don't know much about C#, I'm a beginner programmer and this game is for a college project. Could anyone help me with how I could pull this effect off, or something similar?
    Thank you
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    33,493
    Broadly this is called occlusion culling.

    https://docs.unity3d.com/Manual/OcclusionCulling.html

    Otherwise you can do it yourself with trigger volumes and some code, if you insist.

    Remember also this is likely a completely unnecessary optimization until you get to a fairly large level size. Unity is an absolute BEAST of a game engine.
     
    JamieA806 likes this.
  3. orionsyndrome

    orionsyndrome

    Joined:
    May 4, 2014
    Posts:
    2,634
    The easiest way I could think of would be to partition content into interiors (the rooms) and exteriors (everything but the rooms). You just parent everything that belongs to a room to one such object, then you can toggle its visibility however you need it.