NetworkInstanceId value is zero on build, not in editor

This feels like a bug to me, but I wanted to check here to see if I’m missing something. I am running 2017.1.1 in Arch LInux, but I tested the same code also on my Windows partition with the same results.

Background : My goal is to create a multiplayer turn-based board game. I have created a simple scene with the standard network manager and hud. There are 2 prefabs being used so far, a player prefab which is just a capsule and a script for moving around the board, and a tile prefab which is just a mesh. The board is spawned in a script by instantiating a 2-d array of Tile prefabs, which each have a NetworkIdentity component.

Networking Approach : Since this game is turn-based, my goal was to use a very simple message system which sends player choices to the server who relays the actions to the clients. I created a MoveMessage class inheriting from MessageBase which I had planned to store the NetworkInstanceId value of the targeted tile for the move chosen by the player. The message is sent out with NetworkServer.SendToAll.

The Problem : The value of the NetworkInstanceId for the tiles works as expected in the editor, 1-100 for a 10x10 tile board. The move system works as expected in the editor with just a single client, the host. However when I build the game the move system does not work in the same situation. I have found that every tile’s NetworkInstanceId contains a value of 0. I have tried connecting using the editor as host and build as remote client. The players were both assigned valid netIds, 102 and 103. The tiles are still all 0 in the build only, not in the editor. If I do the opposite and host on the build and join from the editor I get seemingly random null pointer exceptions pointing to initializations in Awake on the move script, but this has nothing to do with setting a NetworkInstanceId. This problem is not due to the timing of any initializations as far as I can tell since I tried waiting a few seconds before checking the values. I do not understand

Maybe I would be better off with the llapi, since I’m just using a simple message system. I just thought the implementation of NetworkIdentity would cut my work out for me, but I can’t seem to get it to work.

My fault. I forgot to call NetworkServer.Spawn. I have no idea why the netId was working in the editor in that case, but it stopped working after updating. After adding the correct function call everything works as expected.