Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

Failed to spawn server object, did you forget to add it to the NetworkManager?

Open basuarya opened this issue 2 years ago • 1 comments

Hello everyone,

I am trying to spawn a GameObject that was dynamically placed in my scene hierarchy on the server side onto the client side. But I am facing the following challenges:

  1. Everything goes smoothly with the OnStartServer() method when preparing the dynamically instantiated GameObject locally on the server. I manually added NetworkObject and NetworkIdentity components to it.
  2. I then register this GO as a registered n/w prefab using NetworkClient.RegisterPrefab method in order to Register spawnable prefab with custom assetId.
  3. I then create a SyncDictionary to hold the custom assetId and the GO as a pair.

Upon doing all of this, I see that on the server side, I have the GO in the SyncDictionary but not on the client side. And I am getting the Failed to spawn server object, did you forget to add it to the NetworkManager? assetId=4051406874 netId=3 on the client side.

How do I get the dynamic GO to be visible on the client side?

See the images below. I am at a loss. I appreciate all the help from this community of scholars and developers.

Thanks in advance!

Screenshot 2024-04-18 at 10 30 35 AM Screenshot 2024-04-18 at 10 30 54 AM

basuarya avatar Apr 18 '24 17:04 basuarya

I was able to solve it. Here are the key hurdles I navigated:

Advanced Serialization: Developing a custom mesh serializer and deserializer (on the fly) from scratch to ensure that complex 3D data transmits accurately and efficiently over different network conditions was challenging and rewarding.

Network Efficiency: The main goal was to minimize latency and maximize throughput within a host-client topology. This required innovative solutions in data compression and chunking strategies to handle real-time mesh updates without sacrificing performance.

basuarya avatar May 01 '24 14:05 basuarya