- Home /
Question by
Bincredible · Feb 15, 2013 at 09:48 PM ·
networkingparentinginstantiating
Parenting on a network.
Hello, I was wondering if there is a way for all of the players to see the instantiated object in a network. When someone on the network instantiates a weapon, they see it on their screen in their hand. But all of the other clients have to go to the place in which the person with the weapon actually instantiated it. For example if someone instantiated a weapon next to a river, and then moved to a bridge. They would still see it on their screen, but other clients would need to go back to the river to see it. Thanks! Here is my current code. :)
if(GUILayout.Button(playerInventory[x].icon) && playerInventory[x].itemType == ItemClass.ItemType.Weapon && equipped == false){
equippedItem = playerInventory[x];
var weapon : Transform = Network.Instantiate(playerInventory[x].itemPrefab,playerHand.position,playerHand.rotation, 0);
playerInventory.RemoveAt(x);
weapon.transform.parent = playerHand.transform;
return x;
}
Comment
Your answer