Problem blendshapes animation

For character customization, I loaded character mash prefab and connected it to rig prefab. The character animation comes out normally, but the facial animation using bendshapes is not working. I checked that there is bendshapes data when loading. Is the rig information wrong?

namespace CL.CLIENT
{
using System.IO;
using UnityEngine;
using UnityEngine.AddressableAssets;

public class CharacterRigLoader : MonoBehaviour
{
public bool IsCompleted { get; private set; } = false;
public CharacterRig Rig { get; set; } = null;

public void LoadRig(string rigPath)
{
if (rigPath == null)
{
App.Error(“rig path is null”);
return;
}

IsCompleted = false;

Addressables.InstantiateAsync(rigPath).Completed += (_result) =>
{
IsCompleted = true;

if (_result.OperationException == null)
{
var characterRig = _result.Result?.GetComponent();

if (characterRig != null)
{
var name = Path.GetFileNameWithoutExtension(rigPath);

Rig = characterRig;
Rig.gameObject.name = name;
}
}
};
}

public void UnloadRig()
{
if (Rig != null)
{
Addressables.ReleaseInstance(Rig.gameObject);
Rig = null;
}

IsCompleted = false;
}
}
}

namespace CL.CLIENT
{
using System.IO;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

public class CharacterPartLoader : MonoBehaviour
{
public bool IsCompleted { get { return _isCompletePart && _currentTextureLoaingCount == 0; } }
public CharacterPart Part { get; set; } = null;

private List<AsyncOperationHandle> _textureInstanceList = new ();
private bool _isCompletePart;
private int _currentTextureLoaingCount;

public void LoadPart(string partPath, string[ ] texturePath, Color skinColor)
{
if (partPath == null)
{
App.Error(“part path is null”);
return;
}

if (texturePath == null)
{
App.Error(“texture path array is null”);
return;
}

foreach(var path in texturePath)
{
if (path == null)
{
App.Error(“texture path is null”);
return;
}
}

_textureInstanceList.Clear();
_isCompletePart = false;
_currentTextureLoaingCount = texturePath.Length;

Addressables.InstantiateAsync(partPath).Completed += (_result) =>
{
_isCompletePart = true;

if (_result.OperationException == null)
{
var characterPart = _result.Result?.GetComponent();

if (characterPart != null)
{
var name = Path.GetFileNameWithoutExtension(partPath);

Part = characterPart;
Part.gameObject.name = name;

AddMaterial(texturePath.Length);

for (int i = 0; i < texturePath.Length; i++)
LoadTexture(i, texturePath*, skinColor);*
}
}
};
}
private void LoadTexture(int textureIndex, string texturePath, Color skinColor)
{
if (texturePath == null)
return;
var instanceHandle = Addressables.LoadAssetAsync(texturePath);
_textureInstanceList.Add(instanceHandle);
instanceHandle.Completed += handle =>
{
_currentTextureLoaingCount -= 1;
if (handle.OperationException == null)
{
Texture[ ] text = new Texture[1];
text[0] = handle.Result;
if (0 < Part.skinnedMeshRenderer.materials.Length && textureIndex < Part.skinnedMeshRenderer.materials.Length)
{
Part.skinnedMeshRenderer.materials[textureIndex].mainTexture = handle.Result;
if (Part.skinnedMeshRenderer.materials[textureIndex].mainTexture.name.Contains(“skin”))
Part.skinnedMeshRenderer.materials[textureIndex].color = skinColor;
}
}
};
}
public void UnloadPart()
{
foreach (var texture in _textureInstanceList)
{
Addressables.ReleaseInstance(texture);
}
_textureInstanceList.Clear();
if (Part != null)
{
Addressables.ReleaseInstance(Part.gameObject);
Part = null;
}
_isCompletePart = false;
_currentTextureLoaingCount = 0;
}
private void AddMaterial(int materialCount)
{
if (Part == null)
{
App.Error(“Part is null”);
return;
}
var materials = new Material[materialCount];
for (int i = 0; i < materials.Length; ++i)
materials = new Material(Shader.Find(“Legacy Shaders/Diffuse”));
Part.skinnedMeshRenderer.materials = materials;
}
}
}
namespace CL.CLIENT
{
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class CharacterAssembler : MonoBehaviour
{
public class CreatePartInfo
{
public string partPath;
public List texturePathList = new();
}
public CharacterRigLoader RigLoader { get; set; } = null;
public List PartLoaders { get; set; } = new();
public bool IsCompleted()
{
if (RigLoader != null && !RigLoader.IsCompleted)
{
return false;
}
foreach (var partLoader in PartLoaders)
{
if (!partLoader.IsCompleted)
{
return false;
}
}
return true;
}
public void CreateCharacterShape(string rigPath, List<CharacterAssembler.CreatePartInfo> createPartInfoList, Color skinColor)
{
RigLoader = gameObject.AddComponent();
RigLoader.LoadRig(rigPath);
foreach (var createPartInfo in createPartInfoList)
{
var partLoader = gameObject.AddComponent();
partLoader.LoadPart(createPartInfo.partPath, createPartInfo.texturePathList.ToArray(), skinColor);
PartLoaders.Add(partLoader);
}
}
public void DeleteCharacterShape()
{
if (RigLoader != null)
{
RigLoader.UnloadRig();
DestroyImmediate(RigLoader);
RigLoader = null;
}
foreach (var PartLoader in PartLoaders)
{
PartLoader.UnloadPart();
DestroyImmediate(PartLoader);
}
PartLoaders.Clear();
}
public CharacterShape GenerateCharacterShape(string name, Transform parent)
{
var characterShape = RigLoader.Rig.gameObject.AddComponent();
characterShape.transform.localPosition = Vector3.zero;
characterShape.transform.localRotation = Quaternion.identity;
characterShape.transform.localScale = Vector3.one;
var rig = characterShape.GetComponent();
rig.gameObject.name = name;
foreach (var partLoader in PartLoaders)
{
var part = partLoader.Part.gameObject.GetComponent();
GenerateCharacterPart(part, partLoader.Part.gameObject.name);
}
rig.animator.cullingMode = AnimatorCullingMode.AlwaysAnimate;
rig.animator.Rebind();
return characterShape;
}
public void ChangePart(CharacterPart.PartType partType, string partAddress, string[ ] textureAddress, Color skinColor)
{
for (int i = 0; i < PartLoaders.Count; ++i)
{
if (PartLoaders_.Part == null || PartLoaders*.Part.partsType != partType)
continue;_

_PartLoaders.UnloadPart();_
_DestroyImmediate(PartLoaders);
PartLoaders.RemoveAt(i);
break;
}
StartCoroutine(OnChangePart(partAddress, textureAddress, skinColor));
}
private IEnumerator OnChangePart(string partAddress, string[ ] textureAddress, Color skinColor)
{
var partLoader = gameObject.AddComponent();
PartLoaders.Add(partLoader);
partLoader.LoadPart(partAddress, textureAddress, skinColor);
yield return new WaitUntil(() => partLoader.IsCompleted);
GenerateCharacterPart(partLoader.Part, partLoader.Part.gameObject.name);
}
private void GenerateCharacterPart(CharacterPart part, string partName)
{
part.gameObject.name = partName;
var rig = RigLoader.Rig;
if (!string.IsNullOrEmpty(part.rootBone))
{
if (rig.bones.TryGetValue(part.rootBone, out var trans))
{
part.skinnedMeshRenderer.rootBone = trans;
}
}
var bones = new List();
if (part.bones != null && part.bones.Count > 0)
{
foreach (var bone in part.bones)
{
if (rig.bones.TryGetValue(bone, out var trans))
{
bones.Add(trans);
}
}
}
part.skinnedMeshRenderer.bones = bones.ToArray();
part.transform.SetParent(rig.transform);
}
}
}*_

I found the cause of the problem. I found the wrong parent of mesh prefab at rigging.