In the 5.6 version, I noticed UNET now throw some errors when it calls StartHost:
“GameObject X is a prefab, it can’t be spawned. This will cause errors in builds.”
However, these are objects in my scene that are GameObjects dragged in from prefabs. They have the NetworkIdentity component. When I break the link from the prefab, the errors did go away, but I can’t understand why they can’t be originated from a prefab. Is this a bug or is there a reason for this?
Here’s the code in UNET related to this…
static bool CheckForPrefab(GameObject obj)
{
#if UNITY_EDITOR
return (UnityEditor.PrefabUtility.GetPrefabParent(obj) == null) && (UnityEditor.PrefabUtility.GetPrefabObject(obj) != null);
#else
return false;
#endif
}
static bool VerifyCanSpawn(GameObject obj)
{
if (CheckForPrefab(obj))
{
Debug.LogErrorFormat("GameObject {0} is a prefab, it can't be spawned. This will cause errors in builds.", obj.name);
return false;
}
return true;
}
Yeah, great, but it was happening when I wasn’t even spawning anything. Just a random prefab in the scene, like my ParticleManager, just randomly started giving those errors. Once I deleted the prefab it started working again…
It is not instantiated by code at any point, it exists in the scene.
What I did was, in the network identity component there was:
m_SceneId:
m_Value: 44
For all other prefabs this was 0, I changed it to zero and the error disappeared.
I think this happens if you have an object where the value has changed and then apply it’s properties to the prefab.
I’m very sorry but I’m really new to unity and the update just demolished my school project, so could someone explain to me What i’m supposed to do to fix this?