当前位置:网站首页>脚本自动选择Hierarchy或Project下的对象
脚本自动选择Hierarchy或Project下的对象
2022-08-11 05:31:00 【星际行走】
今天有个朋友问我怎么样自动显示某个对象的Inspector面板? Unity是当鼠标在Hierarchy或者Project视图中选择一个或者多个Object,然后在右侧Inspector面板上就会显示所有属性。那么其实解决这个问题的方法就是使用脚本去选择一个Object就行。
代码如下
[MenuItem("GameObject/AutoSelect",false,11)]
static void Start ()
{
GameObject go = GameObject.Find("Directional Light");
EditorGUIUtility.PingObject(go);
Selection.activeGameObject = go;
//也可以选择Project下的Object
//Selection.activeObject = AssetDatabase.LoadAssetAtPath<GameObject>("Assets/Cube.prefab");
}

自动选择后

- 本文固定链接: #你好Unity3D#脚本自动选择Hierarchy或Project下的对象 | 雨松MOMO程序研究院
- 转载请注明: 雨松MOMO 2015年12月10日 于 雨松MOMO程序研究院 发表
边栏推荐
- Day 71
- OpenGL中glGenBuffers glBindBuffer glBufferData的理解
- 【LeetCode-36】有效的数独
- Day 79
- Real-time Feature Computing Platform Architecture Methodology and Practice Based on OpenMLDB
- Day 72
- 基于微信小程序云开发实现的电商项目,可以自行定制开发
- 8-byte standard request parsing during USB enumeration
- 【LeetCode-74】搜索二维矩阵
- mongoose连接mongodb不错,显示encoding没有定义
猜你喜欢
随机推荐
C# 基础之字典——Dictionary(二)
【LeetCode-73】矩阵置零
Node stepping on the pit 80 port is occupied
【LeetCode-205】同构字符串
gerrit configure SSH Key and account, email information
Pinyougou project combat notes
欧拉法解微分方程
buuctf hacknote
PyQt5中调用.ui转换的.py文件代码解释
微信小程序启动页的实现
【无标题】
JS案例练习(pink老师经典案例)
Day 71
C语言-6月8日-求两个数的最小公倍数和最大公因数;判断一个数是否为完数,且打印出它的因子
IIC and SPI
He Kaiming's new work ViTDET: target detection field, subverting the concept of layered backbone
虚拟机更改IP地址
欧拉角、四元数与旋转
星盟-pwn-babyfmt
解决AttributeError: ‘NoneType‘ object has no attribute ‘val‘ if left.val!=right.val:Line 17 问题









