IndieGame/client/Assets/Ether/Editor/Tools/SelectEditor/SelectionCount.cs

31 lines
875 B
C#
Raw Normal View History

2024-10-11 10:12:15 +08:00
/****************************************************
: SelectionCount.cs
: signing
: 1982614048@qq.com
: 2021/6/25 9:22:19
:
*****************************************************/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace Ether
{
public class SelectionCount
{
[MenuItem("工具/获取选择物体个数 %#e", false, 3)]
public static void GetSelectionCount()
{
//选中的所有物体
GameObject[] objs = Selection.gameObjects;
Debug.Log(string.Format("已选择 {0} 个物体", objs.Length));
}
[MenuItem("工具/获取选择物体个数 %#e", true, 3)]
public static bool GetSelectionCount2()
{
return Selection.activeTransform != null;
}
}
}