Working on Multiplayer Game using photon pun 2 in Unity. I am trying to synchronize Box which is spawned when player trigger a function. So i need to synchronize game object for all players.enter image description here
Here is Spawning Codeenter image description here
private void SpawnBox()
{
PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs" , "PickableCube"), transform.position, Quaternion.identity);
}
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
SpawnBox();
}
}
I want to synchronize the game object for all players so if any player let the game it should not effect the game objects which are spawned in map . I tried PhotonNetwork instantiate , and also Photon view and photon view transform is applied on the box.