mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-04 13:45:04 +08:00
f7b12d7f82
... fixed by reimplementing ScaleAdjuster (again!)
28 lines
759 B
C#
28 lines
759 B
C#
using UnityEditor;
|
|
|
|
namespace nadena.dev.modular_avatar.core.editor.ScaleAdjuster
|
|
{
|
|
#if !UNITY_2022_3_OR_NEWER
|
|
internal static class SelectionHack
|
|
{
|
|
[InitializeOnLoadMethod]
|
|
static void Init()
|
|
{
|
|
Selection.selectionChanged += OnSelectionChanged;
|
|
|
|
}
|
|
|
|
static void OnSelectionChanged()
|
|
{
|
|
var gameObject = Selection.activeGameObject;
|
|
if (gameObject != null && gameObject.GetComponent<ScaleAdjusterRenderer>() != null)
|
|
{
|
|
EditorApplication.delayCall += () =>
|
|
{
|
|
Selection.activeGameObject = gameObject.transform.parent.gameObject;
|
|
};
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
} |