NetworkIdentity shows "Spawn" button

Hi

I run this code and gameObject appeared, but it doesn’t appears on the other client.

public void SpawnObj (GameObject g, Vector3 pos, Quaternion q)
{
	GameObject g1 = (GameObject)Instantiate (g, pos, q);
	NetworkServer.Spawn (g1);
}

The NetworkIdentity of the gameObject shows “Spawn” button.

The gameObject appeared on the other client after I pushed the button.
I want to do it via script.

This is the picture of the NetworkManager’s inspector.

Please help me.

Is a client spawning these objects or the server? If you are trying to spawn from the client, I believe you need to add the CommandAttribute to the function. Like so:

[Command]
public void SpawnObj (GameObject g, Vector3 pos, Quaternion q)
 {
     GameObject g1 = (GameObject)Instantiate (g, pos, q);
     NetworkServer.Spawn (g1);
 }

Also, this may be kind of dumb but I don’t do much networking so feel free to insult me but make sure your script is derived from NetworkBehaviour