当前位置:网站首页>Unity object path query tool
Unity object path query tool
2022-07-28 20:37:00 【_ Mr orange】
Unity Object path query tool
List of articles
Preface
Hello everyone , I'm an orange , What I bring to you today is Unity Tutorial of scene switching progress bar .
*,*◦*,*◦*,*◦*,-------------------- Gorgeous dividing line --------------------*◦*,*◦*,*◦*,*◦*,*◦
Recently, there are some novice friends , Come and consult oranges , utilize transform.Find perhaps GameObject.Find Inquire about Hierarchy Objects in the window , Empty pointer , The little friends are very confused , It's right , Why did you make a mistake ?
After several inquiries , It turned out to be discovery , Query path , Misspelled a letter , I'm thinking of Have time to write an object path query tool , Easy to use , Also let novice Xiaobai , Avoid low-level mistakes , Improve study or work efficiency .
Tips : The following is the main body of this article , The following cases can be used for reference
One 、 Introduction to the use of tools
stay Unity New China Editor Folder , There may be a little friend's question here ? Why create a new Editor Folder ?
The following is true. Editor Some introductions of folders :
Editor
Edilor The folder can be in the root directory , It can also be in subdirectories , As long as the name is Editor Can . For example, catalog :hox.sooEditor and /Editor It's the same , No matter how many are called Editor Any folder in the library can .Edlior All resource files or script files placed below will not be typed into the release package , And scripts can only be used when editing . Generally, some tool class scripts are placed here , Or some of them for editing DLL. For example, we are now going to make a similar skill editor , So it's better to put the editor's code here , Because we only need the files generated by the editor when we actually run , Without the core code of the editor .
My understanding is that , The scripts in the folder are only in Unity Run... In the editor , Will not be beaten into the bag , Nor can it be used in the bag .
Two 、 Code
1. Copy code
The code is as follows : Remember the script name of the new script Be consistent with mine !
using UnityEditor;
using UnityEngine;
public class ObjPathCopyTool : ScriptableObject
{
[MenuItem("Custom/ Copy the path of the selected object %Q")]// Custom shortcut
static void CopyPath()
{
Object[] objs = Selection.objects;
if (objs.Length < 1)
return;
GameObject obj = objs[0] as GameObject;
if (!obj)
return;
string path = obj.name;
Transform parent = obj.transform.parent;
while (parent)
{
path = string.Format("{0}/{1}", parent.name, path);
parent = parent.parent;
}
Debug.Log(path);
CopyString(path);
}
// Assign a string to the clipboard
static void CopyString(string str)
{
TextEditor te = new TextEditor();
te.text = str;
te.SelectAll();
te.Copy();
}
}
2. Put the code in Editor Folder

After placing , wait for Unity Loading finished .
This is the time , There will be one more menu bar Custom
3、 ... and 、 Use
stay Hierarchy Window , Choose any object .
I chose an object with many levels .
Then press Ctrl+Q Or you can go to the menu bar and click Custom The button below is also ok .
The system will automatically print out the path , Then copy the path to find it
If it's too much trouble , You can connect to download https://download.csdn.net/download/weixin_45375968/85168252
Four 、 summary
It's over here , That's all orange will talk about today , This article only briefly introduces Editor What is a folder , Using gadgets , Quickly get Hierarchy The path of the object in the window , Let's find the object name more quickly , So as to improve learning or work efficiency .
5、 ... and 、 Conclusion
Inferior to silicon step , A thousand miles .
Don't product the little stream , Beyond into the sea .
Make a little progress every day Thank you for watching .
Feel helpful to yourself , Welcome to your attention 、 Collection 、 forward ! See you next time
边栏推荐
猜你喜欢

同质化代币与 NFT 结合,如何使治理结构设计更灵活?

Simple example of C language 1

【CodeForces】Educational Codeforces Round 132 (Rated for Div. 2)
![[task02: SQL basic query and sorting]](/img/10/c2a936c882cd77f422396840282ed5.png)
[task02: SQL basic query and sorting]
About the title of linking to other pages
![[detailed use of doccano data annotation]](/img/40/c18cf8d5519328d707ed89fccb70ee.png)
[detailed use of doccano data annotation]

CNN convolutional neural network structure

七种轮询介绍(后附实践链接)

Storage of C language data in memory (1)

太空射击第13课: 爆炸效果
随机推荐
Torch. NN. Linear() function
Raspberrypico serial communication
太空射击第09课:精灵动画
js图片悬挂样式照片墙js特效
太空游戏第12课: 盾牌
CNN convolution neural network learning process (weight update)
Speech controlled robot based on ROS (I): realization of basic functions
C语言数据 3(2)
New fruit naming (DP is similar to the longest common subsequence)
Raspberry pie CM4 -- using metartc3.0 to integrate ffmpeg to realize webrtc push-pull streaming
Quick sort template
Solve the kangaroo crossing problem (DP)
根据openGauss/MogDB的lwtid查看线程堆栈。
Use of DDR3 (axi4) in Xilinx vivado (3) module packaging
h5微信射击小游戏源码
Dsactf July re
CM4 development cross compilation tool chain production
DSACTF7月re
读取json配置文件,实现数据驱动测试
Explain RESNET residual network in detail