mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-06 14:45:06 +08:00
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
|
|||
|
}
|