change a customProperties in diffrent scripts

Options
I am trying to change a custom property from another script from where it was created so i don´t got the Hashtable that i used to first create the custom property. I don´t know if i have changed my custom propertis the wrong way before by taking the hashtable and chaning it value and then use SetPlayerCustomPropertis with the updated hashtable. like this

private ExitGames.Client.Photon.Hashtable _customProperti = new ExitGames.Client.Photon.Hashtable();

void Start{
_customProperti["CustomProperti"] = "string";
PhotonNetwork.SetPlayerCustomProperties(_customProperti);
}

void onButtonClick(){
_customProperti["CustomProperti"] = "string";
PhotonNetwork.SetPlayerCustomProperties(_customProperti);
}

__________________________________________________________________________________

this don´t work in other scripts becuse the other scripts don´t got acces to _customProperi

Comments

  • Hi , You are trying to set Player's custom property. You can access it from other script by localPlayer reference. as follow
    string savedStr= PhotonNetwork.LocalPlayer.CustomProperties["CustomProperti"]