I would to drop some item and the other player can pick it up too…
I already instantiate it using PhotonNetwork.Instantiate () and I want to add some script for picking up function.
The gameobject has already appearing in hierarchy but no with my script…
Here’s my instantiating code :
GameObject dropItem = PhotonNetwork.Instantiate ("ItemOnTheGround", gameObject.transform.position, Quaternion.identity, 0);
dropItem.AddComponent<PickUpItem> ();
dropItem.GetComponent<PickUpItem> ().item = this.gameObject.GetComponent<ItemOnObject> ().item;
so How I can add component to my instantiated object ?