Set Custom Properties

Options
Hello! We have a problem. When we use play oblects with layered scripts in the scene (doesn't matter what is the type of script - written on C# or on PlayMaker), script's working time:
void SetPlayerProperty()
{
PhotonPlayer _player = PhotonNetwork.player;

ExitGames.Client.Photon.Hashtable _prop = new ExitGames.Client.Photon.Hashtable();

_prop [key] = "privet";
_player.SetCustomProperties(_prop);
}
increases in proportion to the amount of game objects in the scene with layered scripts. In the meantime iOS and Android builds star to lag very much. Is there any way to solve the problem?

Comments

  • vadim
    Options
    Performance drops because of PhotonPlayer.SetCustomProperties sends PhotonNetworkingMessage.OnPhotonPlayerPropertiesChanged message to every script in the scene.
    You can restrict this to list of objects set in PhotonNetwork.SendMonoMessageTargets property or to objects of only type set in PhotonNetwork.SendMonoMessageTargetType.

    win20082007,
    We already answered that via ticket. Please do not cross-post or at least add link to forum post in your ticket. Thanks.
  • Thank you for answer
  • Tried to make that about what it was written above, I can't understand - what exactly needs to be specified in the PhotonNetwork.SendMonoMessageTargets parameters that everything was synchronized between players and not to address to all scripts of a scene?
  • vadim
    Options
    SendMonoMessageTargets does not affect synchronization. Add to this list every object which scripts should receive Photon messages.
    Normally you do not need to handle Photon messages on objects other than single "game manager" object. So just add this single object to SendMonoMessageTargets.
  • vadim said:

    SendMonoMessageTargets does not affect synchronization. Add to this list every object which scripts should receive Photon messages.
    Normally you do not need to handle Photon messages on objects other than single "game manager" object. So just add this single object to SendMonoMessageTargets.

    I added object on which scripts defiant PhotonPlayer.SetCustomProperties hang, to PhotonNetwork.SendMonoMessageTargets, but lags not where didn't disappear, I probably didn't understand which object has to be added that this method didn't look for on all scripts.
  • vadim
    Options
    Temporary comment out SendMonoMessage method body in NetworkingPeer.cs
    This will make clear if sending messages is real reason for performance drop.
  • Thanks for help i found problem.