Eye Animation Doesn'T Work On Photon

We are using Unity, Photon and RPM. I am working on “RPM Photon Support 0.3.1 Avatar Control” scene.

I changed our Avatar Config according to this video: Eye Animation Handler helps you make avatars look more alive #shorts - YouTube

LightShot (prnt.sc)

And I attached that config file to our RPM Photon Character prefab.
I added “eye animation handler” component to the prefab, too.
But after the game loads the avatar, I get this error:

Also, “Eye Animation Handler” component gets disabled on RPM Photon Prefab Clone but I can’t post a screenshot because of “the topic new user limits”

Can someone help me?

Hello and welcome to the forum!
If the component gets disabled, it is probably because the model doesn’t have eyelid blend shapes.
Are you loading the characters at runtime? If so, you need to make sure that you are loading them with the config you made, which includes the morph targets. So you can reference the config on your character loader script and assign it on the inspector, then make sure to use the config on your loading method.

I am using the code from RPM Photon example. As I said on the first message, I assigned avatar config to the RPM Photon Character Prefab NetworkPlayer Component.

GameObject character = PhotonNetwork.Instantiate("RPM_Photon_Character", Vector3.zero, Quaternion.identity);
character.GetComponent<NetworkPlayer>().LoadAvatar("6617e00fce940500008d6e54");

We have pushed a recent update to the package to ensure that the avatar config is set before loading the avatar.
Now I understand there is still an issue with the EyeAnimationHandler component script throwing an error; we were able to reproduce it and track the issue. The team is currently working on a fix, and we will update the package soon. I will keep you posted in this thread as well.

YouTube

Thank you, I have just recorded a video for the bug after the 0.3.2 version.
Please remember to check voice animation handler, too.
It gives same kind of error, too.

any news about the new problem?

Hello,
It’s still being worked on and will be part of the next release but if you want a quick fix in the meantime, you can do these steps:

  • Changes on the RPM_Photon_Character prefab (Can be found under Assets\Samples\Ready Player Me Photon Support\0.3.1\Avatar Control\Resources) :

    1. Remove the EyeAnimationHandler componenet from the prefab we will add it on next step via script making sure it’s added after the avatar is loaded.
      (The issue now is that the code runs before the avatar is loaded so it doesn’t find the blend shapes, this will be fixed in next release).
    2. Double click to enter Prefab edit mode and remove all the Renderer objects except the Renderer_Avatar.
      (We do this because we are loading the character with a config so we would only need that one and we delete the others because currently the script that looks for the blend shapes will find the other SkinnedMeshRenderer components on those objects before it reaches the one that actually has the blend shapes which is the Renderer_Avatar. This will be fixed but as I said it’s a quick fix for now).
  • Changes on NetworkPlayer script (Can be found under Packages\Ready Player Me Photon Support \Runtime)
    Note: For this one, since it’s in the packages folder, it’s better to make a copy of the script in your assets/scripts folder. You can edit the script for test purposes but it will be overridden when you pull the next updates so if you want to make your custom script, make a copy.
    Within the SetPlayer() method, after the AvatarMeshHelper.TransferMesh(args.Avatar, gameObject); line, add gameObject.AddComponent<EyeAnimationHandler>(); to add the Eye Animation Handler component via script after the avatar loading.

Now if you press play, eye blink should work!

Again, this is a quick fix. We will release a proper fix on the next package update.

Will this also work for voice animation handler? It has same kind of error, too

Yes, you can add the gameObject.AddComponent<EyeAnimationHandler>(); via script as well similar to the Eye Animation Handler component to make sure it’s also added after the character has been loaded

hi, any news about the update?

Hello,
This week, we released a new SDK version of the Ready Player Me Core SDK that contains the fix. Please update the package by going to Window → Package Manger → Ready Player Me Core and then click on Update.

You still need to do these steps manually:

  1. Add the Eye Animation Handler Component to the RPM Photon Character Prefab that you can find in the Resources folder. (The same goes for the Voice Handler Component if you also want to animate the mouth).

  2. Create your custom network player script; for instance, you can create a script called CustomNetworkPlayer under the Assets/script folder, copy the existing NetworkPlayer script and paste it into the newly created script. Then, after this line:

    AvatarMeshHelper.TransferMesh(args.Avatar, gameObject);
    

    Add the following lines:

    if (gameObject.GetComponent<EyeAnimationHandler>())
    {
        gameObject.GetComponent<EyeAnimationHandler>().UpdateHeadMesh();
    }
    

(The same goes for the Voice Handler Component if you also want to animate the mouth).

  1. Make sure to change the reference of NetworkPlayer to CustomNetworkPlayer (Within the Photon Setup script).