Instantiation not working

I have this script that is supposed to instantiate a new gameObject to both players whenever one person presses the specified button. For some reason, it doesn't pop up on the other players screen, but after 10 seconds, all of player 2's instantiations dissapear and then the gameObjects instantiated from player 1 start popping up very slowly.

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using Photon.Pun;

public class Test : MonoBehaviour


  public GameObject spawnIn;

  public int rngXMin, rngXMax;

  public int rngYMin, rngYMax;

  public void Update()




      PhotonNetwork.Instantiate(, new Vector2(Random.Range(rngXMin, rngXMax), Random.Range(rngYMin, rngYMax)), Quaternion.identity, 0);




How do I fix this?


  • hi,

    have you add a photon view compenent in your gameObject ? and a transform view componenet ?

  • That is not a known bug of PUN and sounds very much like there is some other issue.

    Maybe you can create a new, empty scene, add scripts to join a room and then run this code with a very light, simple object to instantiate. Does that work better?

    There is nothing in PUN that destroys existing objects, unless you load a scene (where actually Unity usually destroys the objects to replace the old scene). Maybe you load huge assets or have a low framerate or .. you send a lot of other messages, without knowing it.