- Home /
Question by
Eyevi · Apr 24, 2016 at 02:23 PM ·
networkingnetworknetwork.instantiate
Instantiate By ID?
Hello, I'm new with the netcode. So I have a problem with instaniating an object through the network.
[Command]
public void CmdSpawnObject(GameObject objToSpawn, Vector3 position){
GameObject newObj = Instantiate (objToSpawn, position+Vector3.up, Quaternion.identity) as GameObject;
NetworkServer.Spawn (newObj);
}
The Problem is, that it works well on the server side client. On clients it doesn't work, because I can't use GameObject as argument. Is there a way to get an unique id of the object from the prefab folder and find it by its id?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612075518im_/https://answers.unity.com/themes/thub/images/avi.jpg)