Search Unity

Best Way to Handle a 2D Open World in Unity

Discussion in 'General Discussion' started by WizByteGames, Jul 26, 2019.

  1. WizByteGames

    WizByteGames

    Joined:
    Mar 28, 2013
    Posts:
    70
    So I'm working on making a Metroidvania game and I'm trying to figure out the best way to handle the rooms in my map. I would kind of like to avoid loading and unloading everything every time the player enters/leaves a room.

    So I was wondering out of these two solutions what would be best.

    1. Have a scene dedicated to each room. Make each room with a connected room load its adjacent room. So if I have for example 5 room (a,b,c,d,e) and the player is in room e only rooms d and e would be loaded in or if the player is in room c only rooms b, c, and d would be loaded in.

    2. Have a scene dedicated to a section of the world and only have that section loaded in. And for each room only have enemies and other dynamic objects loaded in when the player is in the room.

    I'm not sure how I should go about this at all. I never attempted to make a game that would be this complex before.

    Thanks in advance for the advice.
     
  2. Ayrik

    Ayrik

    Joined:
    Aug 31, 2008
    Posts:
    430
    If your game isn't procedurally generated option 1 is what I would choose. Another option is to use nested prefabs. A simple way to pull it off is to have a master scene that has trigger volumes for each scene/prefab and will load/instantiate it once the trigger is entered and unloads/destroys it on exit. I'm not sure whether it's a good way or not, but I think it's pretty straightforward as long as your world is pre-determined and won't change too much.