In Unity, if a GameObject has a BlendShape, that GameObject always has a SkinnedMeshRenderer.
So I'm using code like the following to determine if the attached GameObject has BlendShapes.
Test.cs
using UnityEngine;
using System;
public class Test : MonoBehaviour
{
SkinnedMeshRenderer testSkin;
// Start is called before the first frame update
void Start()
{
testSkin = GetComponent<SkinnedMeshRenderer>();
if (testSkin != null)
{
Debug.Log("this object have blendShapes");
}
else
{
Debug.Log("this object don't have blendShapes");
}
}
}
However, there are cases that a GameObject has a SkinnedMeshRenderer but not BlendShapes. All objects affected by bone skinning have a SkinnedMeshRenderer.
Is there a way to get only GameObjects that have BlendShape?