avatar/Assets/VRCFury/Scripts/Editor/VF/Menu/MenuUtils.cs

18 lines
493 B
C#

using UnityEditor;
using UnityEngine;
using VRC.SDK3.Avatars.Components;
namespace VF.Menu {
public class MenuUtils {
public static GameObject GetSelectedAvatar() {
var obj = Selection.activeGameObject;
while (obj != null) {
var avatar = obj.GetComponent<VRCAvatarDescriptor>();
if (avatar != null) return obj;
obj = obj.transform.parent?.gameObject;
}
return null;
}
}
}