I’m using AvatarMeshHelper
in my own project. My prefabs are built on the Shooter example armature, with my own RPM meshes used as defaults.
I have code to download medium-res single-mesh avatars.
AvatarMeshHelper throws an error; it seems to want an array of skinned meshes instead of pulling a mesh from a downloaded Ready Player Me avatar.
I’m not using the full res multipart RPM avatar because I have the user choose their customization in a previous scene, then I download the medium res single mesh version using a config file.
How can I solve this?
I’m using Smartfox, but this is for the local player. I have a network player script attached to my Avatar prefab.
public void SetPlayer()
{
// load the medium res avatar, then transfer mesh to Game Creator armature
Debug.Log("avatar URL is " + rpmURL);
if (rpmURL.Length > 0)
{
AvatarObjectLoader loader = new AvatarObjectLoader();
loader.LoadAvatar(rpmURL);
loader.AvatarConfig = config;
loader.OnCompleted += (sender, args) =>
{
GameObject targetPrefab = this.gameObject;
if (VariablesManager.ExistsGlobal("avatar_model"))
{
//switchMeshActionSet.Execute(); // post-load actions in game.
AvatarMeshHelper.TransferMesh(args.Avatar, gameObject, null);
}
else
{
Debug.LogError("Error: something wrong with avatar id URL or model.");
}
};
}
}
Error:
|Severity|Code|Description|Project|File|Line|Suppression State|Details|
|---|---|---|---|---|---|---|---|
|Error|CS1503|Argument 2: cannot convert from 'UnityEngine.GameObject' to 'UnityEngine.SkinnedMeshRenderer[]'|Assembly-CSharp|D:\~Work\~Unity Dev\hundo\hundo x Ruby Room Smartfox v2 addressables\Assets\GameScripts\NetworkPlayer.cs|72|Active||
Screens - Left is Smartfox compatible based on downloaded RPM avatar as default; right is the Photon RPM multiplayer resource.