Scene UNET Obejcts get disabled by NetworkManager and never re-enabled on builds, works in editor

Scene UNET Objects are GameObjects with the NetworkIdentity component, that are not spawned in, but rather part of the scene. According to https://docs.unity3d.com/Manual/UNetSceneObjects.html , although Scene UNET Objects are disabled, they get re-enabled at some point after the scene is fully loaded. Not happening for me. It stays disabled and is breaking my game.

Now something interesting here to note, is that it works and is re-enabled in the editor, but in a standalone build, it does not re-enable.

ANY help at all would be great, I don’t know what the hell is going on. Thanks so much.

I’ve also had this issue before and was caused by calling Awake() with a custom NetworkManager. Any chance you are doing this?

If you aren’t doing that then what command are you using to change scenes? Are you using NetworkManager.ServerChangeScene?

You could try bandaiding the bug with NetworkServer.SpawnObjects(). Did that fix it?

Lastly can you bug report it?

Hey, thanks a lot for the reply. I’m not using Awake or Start. Here’s my custom NetworkManager:

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

public class CustomNetworkManager : UnityEngine.Networking.NetworkManager {

    public static int numOfConnectedPlayers = 0;

    public override void OnServerConnect(NetworkConnection conn) {
       
        numOfConnectedPlayers += 1;
        base.OnServerConnect (conn);
        NetworkServer.SpawnObjects ();
    }

    public override void OnClientConnect(NetworkConnection conn) {
       
        base.OnClientConnect (conn);
        NetworkServer.SpawnObjects ();
    }

    public override void OnServerDisconnect(NetworkConnection conn) {
        numOfConnectedPlayers -= 1;
        base.OnServerDisconnect (conn);
    }

    public override void OnClientDisconnect(NetworkConnection conn) {
        base.OnClientDisconnect (conn);
        GameObject GM = GameObject.FindGameObjectWithTag ("GameManager");
        if (GM != null) {
            GM.GetComponent<GameManager> ().gameStarted = false;
        }

    }
}

I’m using the Offline and Online scene options (from the inspector) w/ the NetworkManagerHUD component.

I tried adding that to my script which you can see in the code I just pasted up there, I put it in OnServerConnect and OnClientConnect. Didn’t do anything. Is that what you meant or should I be putting this somewhere else?

If I can’t find a solution soon I will. Most of the time, though, it’s just user error on my part.

So I tried using the default NetworkManager and it works fine. My scene objects are not disabled when using the default NetworkManager. So that narrows down the problem to my CustomNetworkManager script… (pasted above) No clue what is wrong with it though. Obviously, can’t go w/ default NetworkManager because I need those overrides.

Hmmm not sure what’s going on. If you find out the cause please post and/or bug report.