Double spawning of players on new player joining

Hi,

I was following this tutorial:
https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/pun-basics-tutorial/player-networking

And made it to the end. However in my setup the players seem to spawn double when a new user connects.
I'm pretty confident that it has to do with the static variable on the PlayerManager, but I can't get my head around it.

Here is my project:
https://drive.google.com/file/d/1T44_CZXB-c3UDzCXn4Sn7hldm5do6Gp4/view?usp=sharing

Could anyone point me in the right direction, what am I missing?

Thanks in advance!!

Erik

Comments

  • Hi,

    I did manage to solve it.
    Apparently, Photon was referring to the Kyle Robot prefab that was hidden in the Assets/Photon/Photonnetwork/.. folder and not my Assets/Resources one.
    I just renamed my Assets/Resources/KyleRobot and i got it to work. However I would like to understand better what went wrong here, if someone can explain that would be great because my GameManager was referencing the correct one.

    Erik
  • Hi,

    yes, indeed, you can create many resources GameObjects in the same name and Unity will pick up the first one as it scans the Resources folder in your assets.

    It's not a ghost, it's the resources GameObject from the actual demo itself shipped with PUN.

    We need to put a warning in the tutorial mentioning this, or simply name it slightly different in the tutorial to avoid that.

    Bye,

    Jean

Sign In or Register to comment.