03-26-2018 10:33 PM
03-27-2018 04:47 PM
04-03-2018 05:29 PM
04-06-2018 08:10 PM
Jevsevar said:
Still have the standard blue avatar
using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;
public class PlatformManager : MonoBehaviour
{
public OvrAvatar localAvatarPrefab;
private OvrAvatar localAvatar;
public virtual void Awake()
{
Core.Initialize();
Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
Oculus.Platform.Request.RunCallbacks();
}
void GetLoggedInUserCallback(Message<User> msg)
{
localAvatar = Instantiate(localAvatarPrefab);
localAvatar.oculusUserID = msg.Data.ID;
}
}
When you add it to your game object, you have to drag the prefab from OvrAvatar > Content > Prefabs > LocalAvatar to the "Local Avatar Prefab" field in the script options. Remove the LocalAvatar from the scene if you haven't already, the script will create it.04-16-2018 05:47 PM
04-20-2018 02:22 PM
psionski is a legend! Thank you
psionski said:
Jevsevar said:
Still have the standard blue avatar
I changed my script to work like the one in the Social Starter sample, where there's no LocalAvatar by default in the scene, but instead it gets Instantiate()'d from the prefab once you already have the user ID (in the last callback).
Here's my modified PlatformManager.cs (error handling and entitlement check omitted):When you add it to your game object, you have to drag the prefab from OvrAvatar > Content > Prefabs > LocalAvatar to the "Local Avatar Prefab" field in the script options. Remove the LocalAvatar from the scene if you haven't already, the script will create it.using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;
public class PlatformManager : MonoBehaviour
{
public OvrAvatar localAvatarPrefab;
private OvrAvatar localAvatar;
public virtual void Awake()
{
Core.Initialize();
Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
Oculus.Platform.Request.RunCallbacks();
}
void GetLoggedInUserCallback(Message<User> msg)
{
localAvatar = Instantiate(localAvatarPrefab);
localAvatar.oculusUserID = msg.Data.ID;
}
}
At least for me, this did the trick - now I can see my custom avatar.
If I were to guess what the cause was, probably the comment in the sample script that said "avoiding race condition with"... maybe didn't actually do what it said. Because it seems if you create the OvrAvatar object as late as possible it works (instead of relying on the Start and Awake event orders and manually running the callbacks - maybe this "unrecognized message type" is also related, maybe it "stole" the synchronicity that was intended by the RunCallbacks and then the one we want ended up running late).
04-20-2018 02:22 PM
psionski is a legend! Thank you
psionski said:
Jevsevar said:
Still have the standard blue avatar
I changed my script to work like the one in the Social Starter sample, where there's no LocalAvatar by default in the scene, but instead it gets Instantiate()'d from the prefab once you already have the user ID (in the last callback).
Here's my modified PlatformManager.cs (error handling and entitlement check omitted):When you add it to your game object, you have to drag the prefab from OvrAvatar > Content > Prefabs > LocalAvatar to the "Local Avatar Prefab" field in the script options. Remove the LocalAvatar from the scene if you haven't already, the script will create it.using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;
public class PlatformManager : MonoBehaviour
{
public OvrAvatar localAvatarPrefab;
private OvrAvatar localAvatar;
public virtual void Awake()
{
Core.Initialize();
Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
Oculus.Platform.Request.RunCallbacks();
}
void GetLoggedInUserCallback(Message<User> msg)
{
localAvatar = Instantiate(localAvatarPrefab);
localAvatar.oculusUserID = msg.Data.ID;
}
}
At least for me, this did the trick - now I can see my custom avatar.
If I were to guess what the cause was, probably the comment in the sample script that said "avoiding race condition with"... maybe didn't actually do what it said. Because it seems if you create the OvrAvatar object as late as possible it works (instead of relying on the Start and Awake event orders and manually running the callbacks - maybe this "unrecognized message type" is also related, maybe it "stole" the synchronicity that was intended by the RunCallbacks and then the one we want ended up running late).
04-22-2018 09:55 PM
psionski said:
Jevsevar said:
Still have the standard blue avatar
I changed my script to work like the one in the Social Starter sample, where there's no LocalAvatar by default in the scene, but instead it gets Instantiate()'d from the prefab once you already have the user ID (in the last callback).
Here's my modified PlatformManager.cs (error handling and entitlement check omitted):When you add it to your game object, you have to drag the prefab from OvrAvatar > Content > Prefabs > LocalAvatar to the "Local Avatar Prefab" field in the script options. Remove the LocalAvatar from the scene if you haven't already, the script will create it.using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;
public class PlatformManager : MonoBehaviour
{
public OvrAvatar localAvatarPrefab;
private OvrAvatar localAvatar;
public virtual void Awake()
{
Core.Initialize();
Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
Oculus.Platform.Request.RunCallbacks();
}
void GetLoggedInUserCallback(Message<User> msg)
{
localAvatar = Instantiate(localAvatarPrefab);
localAvatar.oculusUserID = msg.Data.ID;
}
}
At least for me, this did the trick - now I can see my custom avatar.
If I were to guess what the cause was, probably the comment in the sample script that said "avoiding race condition with"... maybe didn't actually do what it said. Because it seems if you create the OvrAvatar object as late as possible it works (instead of relying on the Start and Awake event orders and manually running the callbacks - maybe this "unrecognized message type" is also related, maybe it "stole" the synchronicity that was intended by the RunCallbacks and then the one we want ended up running late).
05-03-2018 11:34 PM
05-03-2021 08:34 AM
I've got the same problem, but the same fix doesn't seem to work for me! I'm trying to get the customized avatar in the editor with a test user. I've got a Quest using Oculus Link, and I'm using Unity 2019.4.25 and the Oculus XR Plugin 1.8.1. I created an app on the Oculus Developer Dashboard (for the Quest). I've created a few test users. I'm targeting PC/Standalone in build settings, even though I plan on switching to Android. I've logged in with one of the test users to my Quest, and I've logged in on the OculusPlatformSettings. I've put the App ID in the OvrAvatarSettings and OculusPlatformSettings (in both Rift App Id and Quest fields). I customized the Avatar for my test user.
I perform and pass my entitlement check successfully, then I successfully get my user ID, then I instantiate an Avatar and apply that ID to the OvrAvatar script. I've also tried applying some of the test IDs from the docs page, but I always see the same, unchanging avatar.
I'm kinda stuck here. Does anyone have any leads?