ActiveEditorTracker

原文参考链接:
https://blog.csdn.net/zryxh1/article/details/80246904

 

ActiveEditorTracker.sharedTracker.activeEditors

ActiveEditorTracker.sharedTracker.SetVisible(i, 0); //0是折叠, 1是展开

 

比如我想做的功能是折叠选中的GameObject的子节点, 代码如下:

 

var editors = ActiveEditorTracker.sharedTracker.activeEditors;
for(int i = 0; i < editors.Length; ++i)
{
  if(editors[i].GetInstanceID() == Selection.activeGameObject.GetInstanceID())
  {
    ActiveEditorTracker.sharedTracker.SetVisible(i, 0);
    break;
  }
}

 

posted @ 2022-05-27 20:25  蓝闪  阅读(99)  评论(0编辑  收藏  举报