Redundant Realtime instances for division of labor between scenes

Moar multi scene questions! I typically structure my scenes as “UI”, “UI_Lab” (for sandboxing), “World”, “SDK_X”, and then daisy chain load them depending on the platform, or production state. These scenes communicate across the project via a message bus, but are able to have limited functionality when launched standalone. This pattern greatly helps to troubleshoot and reduce bloat. I would like to do the same with Normcore, but I am dependent on the same Realtime instance in this regard. If the room name is the same, but I have this division that all may have Normcore networked functionality, what is the best practice?

If this is not clear, imagine two scenes: “UI” with a menu slate GO that changes the color of a cube via a button, that has a model that syncs that the button has been clicked. A regular non-model C# event is fired when the button is clicked. “World” contains a cube. When the button click event is fired, it changes the color, BUT, it can also change color when it is picked up, so it also has a model. They are in different scenes, which both have a Realtime instance which points to the same room. How will Normcore treat this arrangement?

If you’re additively loading the scenes on top of each other and they’re all supposed to work in the same room, then you should use a single Realtime instance. Normcore knows how to find the single Realtime instance automatically even if it’s not in the scene being additively loaded. RealtimeViews in the newly loaded scene and prefab instantiation will work automatically. You don’t have to write any special logic to communicate across scene boundaries. Using multiple Realtime instances connected to the same room will waste bandwidth and you’re not guaranteed that updates that occur in the same frame will be sent out in the same packet. Dealing with ownership will also be a mess.

The one thing you’ll want to make sure of is that if you’re using RealtimeViews in multiple scene files (as opposed to only dealing with prefabs) that you’re additively loading the same scenes on all clients so they have the same game objects available to display the changes.

Max

Right, thanks, but I want to test each scene individually as well as daisy chained. What I’m thinking of is a helper script that would be first in execution order that would destroy the realtime instances in ancillary scenes during awake if more than one scene is loaded…or perhaps uncheck loadOnStart, and check it only if it’s the only scene loaded.

It’s a crude method, but it seems to be effective and simple.