最近在弄3d模型,每次隐藏/显示物体都要鼠标点下勾选框,对于有点腱鞘炎的我,简直酸爽上天。
于是乎,找了下自定义快捷键方法。代码如下:
using UnityEditor;
using UnityEngine;
public class CustomKeys : Editor
{
[MenuItem("Custom快捷键/F1按键 _F1")]
static void EditorCustorkKeys1()
{
Transform active = Selection.activeTransform;
if (active == null)
return;
bool isactive = active.gameObject.activeSelf;
active.gameObject.SetActive(!isactive);
}
}
将如下脚本文件放入Assets/Editor文件夹下,如没有Editor文件夹 请新建
然后点击F1键,就可实现物体隐藏/显示了,食指解放。。真好