shirln

代码:

 [MenuItem("Tools/GetChance", false, 1)]
    static void GetChance()
    {
        if (Selection.gameObjects.Length > 0)
        {
            Debug.Log(Selection.activeGameObject.name);  
            Debug.Log(Selection.gameObjects.Length);
        }
        else
        {
            Debug.Log("请选择至少一个游戏物体");
        }  
    }

说明:Selection.gameObjects.Length:选中游戏对象的个数

           Selection.activeGameObject.name:第一个选择的游戏对象的名字。

分类:

技术点:

相关文章:

  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-28
  • 2022-12-23
  • 2021-04-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
相关资源
相似解决方案