Why Custom Properties dont synch to players that join later?

Options

Hello I have question

I have simple script that sets up Custom Property:

I read this across players with PropertiesUpdate:

This code works as intended in-game

Which is when player walks on platform it equips weapon on his back

But my problem is when another player joins the state of equipped weapon is not synchronized.

As shown the last player that just joined does not see that weapon was picked up prior.

Can someone explain to me what is missing here so the custom properties synchronize properly?

Answers

  • tleylan
    Options

    Hi Snake, I won't be able to give you a definitive answer, I don't quite know what you are doing BUT I might be able to be a little helpful. Four lines can be reduced to one succinct one as follows.

    weaponOnBack.gameObject.SetActive(_index == 1)

    As I said I don't quite get it but you seem to only call EquipItem if photonView.IsMine is false and EquipItem checks if photonView.IsMine is true. Is that combo possible?

  • snake551
    Options

    Optimising this code is not my question, this is just placeholder code to test out photon functionality, The code itself works as its intended to work.

    Problem resolved.

    Simply put "custom properties" arent stored as room options, So approach I used is to set player profiles as room properties rather than custom properties. From my understanding room properties store everything that session has

    whereas custom player properties only what user has during the session so when new user joins what previously existed will never synch as it does not exist for that user until the other user makes action to trigger this property.

  • tleylan
    Options

    That is good info. I really need to delve into Pun (and eventually Fusion) a whole lot more but there are a finite number of hours in a day and I'm the only person working on my project.

    Thanks.