Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Question Client Error: Failed to spawn server object

Discussion in 'Multiplayer' started by kentzeus, Jul 16, 2020.

  1. kentzeus


    Mar 1, 2020
    Hey, I have both dragged the prefabs into the inspector and registered it in the networkmanager script but it still doesn't work. On the server everything works as expected.
    Code (CSharp):
    1. public class NetworkManager : Mirror.NetworkManager
    2. {
    3.     public override void OnStartClient()
    4.     {
    5.         var spawnablePrefabs = Resources.LoadAll<GameObject>("Assets/Prefabs/Spawnable");
    6.         for (int i = 0; i < spawnablePrefabs.Length; i++)
    7.             ClientScene.RegisterPrefab(spawnablePrefabs[i]);
    8.     }
    9.     public override void OnStartServer()
    10.         => spawnPrefabs = Resources.LoadAll<GameObject>("Assets/Prefabs/Spawnable").ToList();
    11. }
    I get these two errors:
    Failed to spawn server object, did you forget to add it to the NetworkManager? assetId=e34ffb03-4678-de04-9ab1-51775452d25a netId=3
    Could not spawn assetId=e34ffb03-4678-de04-9ab1-51775452d25a scene=0 netId=3

    Any suggestion on how to solve this issue?
    Last edited: Jul 16, 2020