Hi. I have different maps in my game and each has a set of buttons, which need to be synchronized between players. I have these maps as prefabs, and I want to spawn them in runtime for all clients. The problem is, I have to synchronize these buttons somehow and I know it's not allowed to spawn prefabs with nested network objects :( Do you guys know any work around for this? Technically I could just have these maps all in the scene, not as prefabs, and I could turn them on/off, but that's just ugly.
#Spawning prefabs with nested Network Objects
1 messages · Page 1 of 1 (latest)
Network object should only be on the root of the prefab. And unless those are world space UI, the UI elements should be kept local to the client canvas
Usually I would have a single UI manager that is syncing button state and what not
uhh by "buttons" i mean 3d objects, not UI elements. they react to player collision and fire events. sorry for not being precise enough
Same principles still apply. You only need a NetworkObject on the root. Manage the syncing of the buttons in a NetworkBehaviour. This can either be on the root with the NetworkObject or in a separate NetworkBehaviour on the buttons.