# Unity5 NetworkServer spawn method works only inside the editor

I have a script that calls the server to spawn an object when the user press a certain key. The script inerhits from NetworkBehaviour and is attached to the players prefab.

void Update() {
if(!isLocalPlayer) return;
if(Input.GetKeyDown(KeyCode.Space)) CmdSpawnCrap();
}

[Command]
void CmdSpawnCrap() {
GameObject cube = Instantiate(objectToSpawn, spawnPoint);
NetworkServer.Spawn(cube);
}


The problem is that it only works when i create the host inside the editor. As soon as i start a host from the standalone build and start as client in the editor it doesnt work anymore. I read/watched a lot of tutorials and everybody told to spawn objects only at the server, in order to be viewable by all instances.

I registered the Cube prefab in the network manager, the prefab has a NetworkIdentity and a NetworkTransform.

I also tried to put the script on an empty gameobject in the scene, but with the same result.

Any ideas why this occurs?

Thank you

EDIT

I had empties in the scene with a tag "SpawnPoint" to spawn.. of cource that wont work across the network because the only points was locally on the client so i used the NetworkStartPosition gameobjects and it worked. Sorry for that but maybe it helps someone else.