1
votes

hello so i made a simple network from this video https://unity3d.com/learn/tutorials/topics/multiplayer-networking/merry-fragmas-30-multiplayer-fps-foundation

i have network Identity on the prefab saved and put in a game manager

but wen i try to connect as a client and yes i have a running host but wen i connect as a client i get this

Spawn scene object not found for 1 UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

http://imgur.com/a/t3Qpp

2

2 Answers

0
votes

You have not registered any "Spawnable prefabs" under Network Manager -> Spawn Info

Put your prefab you want to spawn there and you will be able to spawn it across the network.

0
votes

Once a project grows, you may have dozens of NetworkIdenties in the scene which need registering, it is easy to miss some, and is one cause of the common "Spawn scene object not found" error.

I wrote this editor script to check if any SceneObjects are not registered with the NetworkManager. Add it to an editor folder, and run it using the Tools menu.

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEditor;

public class CheckUNETSceneRegistered : ScriptableObject {

    const string menuName = "UNET SceneObjects Registration Check";

    [MenuItem("Tools/Check UNET SceneObjects are Registered")]
    static void DoCheck()
    {

        NetworkManager networkManager = FindObjectOfType<NetworkManager>();

        if(networkManager == null)
        {
            EditorUtility.DisplayDialog(menuName, "No NetworkManager found", "OK", "");
            return;
        }


        List<string> registeredPrefabNames = new List<string>(networkManager.spawnPrefabs.Count);
        foreach (GameObject g in networkManager.spawnPrefabs)
            registeredPrefabNames.Add(g.name);

        int i = 0;
        foreach (NetworkIdentity uv in FindObjectsOfType<NetworkIdentity>())
        {
            if (!registeredPrefabNames.Contains(PrefabUtility.GetPrefabParent(uv.gameObject).name))
            {
                Debug.LogError("Found " + uv.name + " in the scene, but its prefab " + PrefabUtility.GetPrefabParent(uv.gameObject).name + " was not registered");
                i++;
            }
        }

        EditorUtility.DisplayDialog(menuName, ( i>0 ? "Found " + i + " unregistered Scene Objects.  See Logs." : "All OK" ), "OK", "");
    }
}