Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question How to detect if a user doesn't have a Meta Avatar or if they have been assigned a default avatar?

Discussion in 'VR' started by ROBYER1, Nov 14, 2022.

  1. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,399
    I am working with the Meta Avatars SDK and can't find any way to detect if a user doesn't already have a Meta Avatar, and as part of this I can't find a way to detect if the user has simply been assigned a default avatar.

    I have the ability to let the user open the customise avatar menu via a deeplink call, but no way to detect if I should tell the user to create an avatar first time.
     
  2. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,399
    Found it in OVRAvatarEntity.cs

    Code (CSharp):
    1.  /// True if the avatar has any avatar loaded other than the default avatar.
    2.        public bool HasNonDefaultAvatar { get; private set; }
    Also I tried a suggestion of using the mirror ie.from the Oculus Avatar samples > mirror scene which gives me this error for a user who has no avatar, which is of no good as it actually causes issues in the build!
    [ovrAvatar2 sampleAvatar] Unable to find user avatar with userId 4961820950580892. Falling back to local avatar.


    Checking hasNonDefaultAvatar from above worked though I had to check that value like 10-15 realtime seconds after avatar loading as it flagged wrong until the user's actual avatar has fully loaded as the loading callbacks fired early