I’m working on a project that uses the default unity networking (raknet) to handle its replication. I’m having a problem where my networked buffered events (rpc calls vs network.Instainate) are in backwards order. Am I completely missing something here?
Here is the specific case. On the server, I call an RPC networked load level. then I spawn some npcs using Network.Instainate. The client connects, it gets the npcs first, then the rpc to load the level, cloppering my NPCs.
Are you sure they’re being sent before the level loading RPC, or are they being sent before the level has finished loading? Did you follow the docs example on network level loading?
I did read the docs, and the rpcs are called after the level is loaded (I can even see it in the log with the full debug enabled that they are called in that order on the server, then its backwards on the client)
LoadLevelRPC (which is buffered, and the messaging is disabled to wait for the load to complete)
NPC load RPC (called with Network.Instantiate)
NPC load RPC (called with Network.Instantiate)
NPC load RPC (called with Network.Instantiate)
on the client I get
NPC load RPC (called with Network.Instantiate)
NPC load RPC (called with Network.Instantiate)
NPC load RPC (called with Network.Instantiate)
LoadLevelRPC (which is buffered, and the messaging is disabled to wait for the load to complete)
That is indeed strange… but it shouldn’t matter if you’re moving the loading clients into a separate network group during loading like in the docs example. They shouldn’t see the npc RPC’s until they’re moved back into group zero after the level is loaded for them.
Are you sure the NPC load RPC’s are in reverse order? Or is it just doing the LoadLevelRPC last?
I tried converting my npcs creation to RPC calls, thinking maybe Network. Instantiate works differently, no dice, still happens the same way. In the backwards order that they are done on the server.
Except now the spawn doesnt happen because the RPC functions are blocked by the level prefix check, and the level prefix isnt correct because the RPC functions are in the wrong order.
I may be crazy but I think I’m having this same problem…I can see the server sending out the rpc’s in the correct order, but on the client they are received in reverse order.