Hello, I started trying to just convert a simple board game from global game jam this past weekend into a networked game for the first time. I’ve concluded so far that none of the scripts or transforms will sync unless they are a part of the player prefab or spawned during runtime, is this true?
The game has 150 hex tiles, a dozen game pieces, a board controller, a game controller and a sound controller. Do I really need to blow away everything in the scene and either spawn all of them at runtime through the network manager (or worse attach every script to a single player prefab) for all of these objects to sync properly? This just seems absurd and I feel like there has to be a better way.
If I can at least reference the spawned local player prefab and GetComponent on one script on it I could probably organize everything well by placing all of the needed commands in one place, but I couldn’t find anything like this in the documentation.
With UNET you have some options. There are
1: Spawned objects
2: Scene objects
3: UNET MessageBase (basically you just send data and have to code it all yourself)
Every networked object needs to have a NetworkIdentity.
I’ve had good luck with UNET scene objects as long as all players are connected before you enter the scene with all the networked objects. If you have late-connecting players try to enter while people are in the scene with networked scene objects then I’ve run into errors.
Thanks, I’ll try separating the scene with the board as something that both players transition to after connecting. I already have a NetworkIdentity on everything that needs to be synced, the game pieces and the controller scripts, but simple things like commands and NetworkTransforms weren’t working from the client to the server unless it was a part of the player prefab, or spawned during runtime.