- Home /
Question by
jamezzz · Aug 12, 2018 at 12:47 PM ·
networkingnetwork.instantiate
Instantiating a gameobject in a network
I am using the UNET system in my game but now that network.instantiate is obsolete, how do i instantiate an object so that all clients can see it?
I am trying to fire a bullet from the players gun so that it appears on every player's screen but it only shows for the client who fired the gun.
i have tried instantiating an object with a NetworkIdentity component attached but this still only shows for the 1 client.
in advance, thanks for the help :)
Comment
Best Answer
Answer by terabix · Aug 12, 2018 at 12:50 PM
GameObject gameobject = Instantiate(prefab, new Vector2(x, y), Quaternion.identity);
NetworkServer.Spawn(gameobject);