Search Unity

How to refresh Oculus Avatar after changing id?

Discussion in 'VR' started by Bender_R, May 5, 2020.

  1. Bender_R

    Bender_R

    Joined:
    May 21, 2018
    Posts:
    115
    Hi there,

    I can't seem to find many examples of working with Oculus Avatar.

    I want to change an avatar I have in scene based on another ID (other avatar), but I must be missing something, because the avatar is not refreshing. This is my code:

    Code (CSharp):
    1.         var avatarScript = avatar.GetComponent<OvrAvatar>();
    2.  
    3.         if (avatarScript != null)
    4.         {
    5.             Debug.Log(id);
    6.             avatarScript.oculusUserID = id;
    7.             avatarScript.RefreshBodyParts();
    8.  
    9.         }
    Any ideas?
     
  2. CompuGeniusPrograms

    CompuGeniusPrograms

    Joined:
    Aug 27, 2018
    Posts:
    41
    You must attach the ID at Start. You can either do this by authentication, or right when the scene starts. I'd recommend doing it right when you get the ID, or perhaps starting a new scene once you get the ID.