Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Third Party Photon : Changing playerpref string to hash/custom player player property.

Discussion in 'Multiplayer' started by joshuaradec, Jan 10, 2022.

  1. joshuaradec


    Jun 14, 2019
    I have a script where at runtime, a playerpref is called, but unfortunately, on clientside, everything will just a copy of said pref, which is not what I wanted as it creates issue.

    I am stuDYING custom player property and hash, a bit new to photon in general, but got myself overwhelmed and stuck.

    This is where the playerpref get saved

    Code (CSharp):
    1. private void OnAvatarCreated(string url)
    2.         {
    3.             if (avatar) Destroy(avatar);
    5.             webView.SetVisible(false);
    6.             loadingLabel.SetActive(true);
    7.             displayButton.SetActive(false);
    8.             PlayerPrefs.SetString("URLRPM", url);
    10.             AvatarLoader avatarLoader = new AvatarLoader();
    11.             avatarLoader.LoadAvatar(url, null, OnAvatarImported);
    12.         }
    And this is when it's loaded

    Code (CSharp):
    1.   public void Start()
    2.     {
    3.         AvatarURL = PlayerPrefs.GetString("URLRPM"
    4. }
    6. public void AvatarLoaderHa()
    7.     {
    8.         AvatarLoader avatarLoader = new AvatarLoader();
    9.         avatarLoader.LoadAvatar(AvatarURL, OnAvatarImported, OnAvatarLoaded);
    11.    }
    the AvatarURL is what I believe is the key, but as in yet, I am unable to solve it.
  2. joshuaradec


    Jun 14, 2019
    On that note, I also need help in send and grab/get hashtable
  3. tobiass


    Apr 7, 2009
    Using Hashtables should not be an issue. Is it? If so, you may want to first read up on some C# / programming basics. Just enough to feel at home, when these things are required.
    Do you know how to instantiate regular / non-customized avatars in PUN? If not, start with that. For that, I would recommend the PUN Basics Tutorial.
    To customize avatars, I would recommend to create a basic prefab. Instantiate that, then load and apply a custom avatar to it, per player. The benefit here is that PUN never runs into a situation where it would have to wait for an avatar to load, when it is asked to instantiate some character (this is not supported).