Is using PhotonNetwork.room.SetCustomProperties expensive?

Options
I wonder if using a lot of PhotonNetwork.room.SetCustomProperties is expensive.
Would it be more expensive than using lots of FindGameObjectsWithTag?
Unity says FindGameObjectsWithTag is kinda expensive function.
I am going to display in-game leaderboard and I think these 2 functions are solutions for it.
I'd like to know which one is better in performance. I am going to
Can anyone answer this silly question?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @mhhk88,

    The question is irrelevant here.
    I don't think it makes sense to compare Unity methods with Photon ones.
    Also, FindObjects or GetComponent etc. are expensive in a matter of CPU or memory.
    In Photon you should mostly worry about network related stuff like load or traffic.

    So performance is relative and it depends on what kind of performance you are looking for.

    SetCustomProperties is OK if you call it a few times and not every frame or in consecutive frames.
    You send an operation request to the server, then the server will reply with an operation response and send an event to joined actors.
    So you should ask yourself how often do you need this as a single SetCustomProperties can cost from 2 to (2 + 2 * n where n = number of joined actors) messages. (more details)

    We recommend migrating to PUN2 btw.

    PUN's source code is mostly open so you can find out what SetCustomProperties calls underneath.