modular-avatar/Runtime/ScaleAdjuster/ScaleAdjusterRenderer.cs
bd_ f077d24d48
fix: improved Scale Adjuster implementation (#730)
This new implementation avoids creating any internal objects within the avatar
itself, instead creating them as hidden scene root objects. We also move all update
processing to be driven by camera callbacks as well. These changes help improve
compatibility with tools such as FaceEmo, as well as being less likely to break when
other tools manipulate the avatar's hierarchy directly.
2024-03-05 17:19:54 +09:00

33 lines
720 B
C#

#region
using UnityEngine;
using VRC.SDKBase;
#if UNITY_EDITOR
using UnityEditor;
#endif
#endregion
namespace nadena.dev.modular_avatar.core
{
/// <summary>
/// Legacy component from early 1.9.x builds.
/// </summary>
[ExecuteInEditMode]
[AddComponentMenu("")]
[RequireComponent(typeof(SkinnedMeshRenderer))]
internal class ScaleAdjusterRenderer : MonoBehaviour, IEditorOnly
{
#if UNITY_EDITOR
private void OnValidate()
{
if (PrefabUtility.IsPartOfPrefabAsset(this)) return;
EditorApplication.delayCall += () =>
{
if (this != null) DestroyImmediate(gameObject);
};
}
#endif
}
}