Unity Photon OnTriggerEnter & PhotonNetwork.Destroy
Options
playerMove = other.GetComponent<playerMovement>();
if (playerMove.gunSlotFull == false)
{
PhotonNetwork.Destroy(this.gameObject);
}
In the playerMovement script the gunSlotFull turns into true.
This script attached to the object that i want to destroy, also this object has a photon view.
All works fine but in the other player its bad, its destroying the object all the time.
How can i fix it?
if (playerMove.gunSlotFull == false)
{
PhotonNetwork.Destroy(this.gameObject);
}
In the playerMovement script the gunSlotFull turns into true.
This script attached to the object that i want to destroy, also this object has a photon view.
All works fine but in the other player its bad, its destroying the object all the time.
How can i fix it?
0
Comments
-
This is a "networked" destroy. It is meant to destroy the related object on the other client.
Networked objects need to be existing in all clients or none. There is no support to have it in some.0 -
First, if it helps, i did PhotonNetwork.Instantiate to this object in other script. Second, how can i fix it to not destroying all the time?
0