Unity PUN Level Changing Etiquette.

First off, I just want to say how valuable this forum has been to me over the last few years. Thanks for always providing excelling feedback, assistance and support of the last 6 years. I typically lurk rather than post. Anyhow, I am curious about the "proper" way to manipulate scene in unity when it comes to networking in general. I'm a little familiar with creating a singleton and moving from scene to scene depending on if we're in a lobby, or at the main screen or in an active game. My questions, finally, are these: What are the benefits of having fresh scenes for each game state? When would these benefits begin to outweigh the ease of simply enabling/disabling gameObjects depending on circumstances? What is the general consensus on going with the more simple route(activating and deactivating props)?

Whatever information you can provide, I would greatly appreciate!

Comments

  • Thanks for the nice words. Much appreciated!

    The scene handling is more of a general Unity question and we don't really dive into this topic. I would say it's a question of preference and self-organization and with the option to load multiple scenes, the lines blur further. One benefit of distinct scenes is that you can (better) edit them in parallel.

    I hope someone else has some input on this?!
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited January 2021
    Hi @James_MF,

    Thank you for choosing Photon and for your nice words!
    Usually others complain while posting duplicate questions without searching the forum first or reading the documentation.

    I agree with @Tobias, this is a Unity question.
    When to use scenes and when not to use scenes:

    I think there may be some cases depending on the project scale/size where using scenes is a must
    Using scenes gives you the following (non exhaustive list) benefits:

    - easier / better testing: each scene needs to be self contained and standalone to be run & tested separately. scenes need to be decoupled and independent.
    - easier / better collaboration workflow: since unity files and version control systems still don't play along very well, having multiple scenes is good so multiple team members can work on distinct different scenes separately at the same time.
    - "divide to conquer": splitting your project into smaller chunks is always better (even for performance reasons, think of additive scene loading (read the unity glue))...and you can also split the scene into prefabs (make everything a prefab even if you use it once or don't runtime instantiate it)
  • JohnTube
    JohnTube ✭✭✭✭✭
    From Photon's (PUN) point of view though, I think if you use networked objects (network instantiation) avoiding scenes could help you get rid of some issues like persisting a networked object across scenes, timing of scene loading vs. network instantiation, lifetime of networked object vs. 'lifetime of loaded scene', etc.
  • My pleasure! You guys are great. I understand that I am "that poster" that posted duplicates or otherwise unnecessarily, but I genuinely didn't find any other source after a few moments of searching around. I'm sure you hear that a lot, though.

    Thanks for the insight. I'm gathering that it comes down to preference and how I just want to manage my workload. For the sake of efficiency regarding JohnTube's point, I will keep them separate and go through the headache of loading scenes, re-instantiating scene-specific objects, and persisting network objects important of gameplay. Not to mention collaborating. A level designer would much rather have their own little sandbox to work with rather than have to work around a prefab that would otherwise get instantiated over the network at runtime.

    Thanks again!