31 lines
875 B
C#
31 lines
875 B
C#
|
/****************************************************
|
|||
|
文件: 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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|