"GameObject Player is a prefab, it can't be spawned. This will cause errors in builds."

I have a LobbyNetworkManager and a player prefab that I have dropped in the, well, “Game Player Prefab” field. Now the following error occurs: “GameObject Player is a prefab, it can’t be spawned. This will cause errors in builds.” - and indeed, the player crashes upon game start while in build.

What is the correct way to spawn a game player using LobbyNetworkManager, if not with a prefab? I am using Unity 5.6.0b6.

It’s intentional based on this post, and you have to instantiate the prefab first, then spawn the instantiated gameobject.


Removing the Network Identity (and all components depending on it) and adding it again fixed the issue for me.
I have a prefab that is instantiated in OnServerStart and spawned with NetworkServer.Spawn afterwards that was resulting in the error somehow.

Apparently, it was a bug by Unity? In Edit → Project Settings → Editor, setting the Asset Serialization Mode to “Force Text” causes Unity to rebuild the assets. After resetting to “Mixed”, the error disappeared and the build no longer crashes.

There seems to be code to check for prefabs new in 5.6 which throws an error when a prefab is detected in NetworkServer.Spawn . Not sure why it is?


Can someone help me with this please, I can’t remove network identity because scripts rely on it and i have about 15 prefabs i need to add all are messed up. PLEASE SOMEONE HELP

I was able to fix this error on 5.6.0f3 by resetting the NetworkIdenity Component (no need to remove and re-add it.

Now I have the same problem with steramVR CameraRig.
It’s saying I can’t spawn the head component of the cameraRig.

How do you deal with child objects of the prefab?

The NetworkIdentity and NetworkTransform placed on the parent: CameraRig.

I’ve changed the Asset Serialization to Mixed. Erased and added the components again.

I found another solution to this avoiding the need to remove the NetworkIdentity component:

  1. Select the prefab
  2. Change the Inspector to Debug mode
  3. Locate the NetworkIdentity component
  4. Expand “Scene Id” and change “Value” to 0

I guess this does a similar thing to resetting it