当前位置:网站首页>Some common skills on unity inspector are generally used for editor extension or others
Some common skills on unity inspector are generally used for editor extension or others
2022-07-06 04:50:00 【charlsdm】
RequireComponent
RequireComponent For giving Object Add the necessary components , It can also be understood as replacing “Add Component” The operation of , It can effectively avoid errors caused by forgetting to add necessary components , It also applies to multiple Object Add scenes with the same components , There is no repetition .
in addition RequireComponent The code needs to be placed in front of the class
[RequireComponent(typeof(Rigidbody))]
[RequireComponent(typeof(AudioSource))]
It should be noted that , When you want to remove through RequireComponent When adding components , You need to remove the script first , Otherwise, the following warning will be generated .
Range
Range Limit the value range of variables , But only in Inspector Window , in other words , Changing the value of a variable through code is not affected by Range Constrained
[Range(1, 5)]
public int Speed;
[Range(0,1)]
public float Time;
Space
Space send Inspector The spacing between fields in the window increases
public float Max;
public float Min;
[Space()]
public float Speed;
SerializeField
Generally speaking , Only public Will be displayed in Inspector Window , but SerializeField The access modifier can be ignored , send private Variables of can also be displayed
private bool NotInInspector;
[SerializeField] private bool InInspector;
HideInInspector
send public The field of is not displayed in Inspector Window
[HideInInspector]
public float Hide;
public float notHide;
Tooltip
by Inspcetor A text description is attached to the fields in the window
[Tooltip("Health value between 0 and 100.")]
public int Health = 100;
Header
to Inspector Field with title , Implement grouping
[Header(“Text”)]
public Text hp;
public Text mp;
public Text power;
public Text defense;
边栏推荐
猜你喜欢

11. Intranet penetration and automatic refresh

The implementation of the maize negotiable digital warehouse receipt standard will speed up the asset digitization process of the industry

Bill Gates posted his 18-year-old resume and expected an annual salary of $12000 48 years ago

Extension of graph theory

行业专网对比公网,优势在哪儿?能满足什么特定要求?

RT thread analysis - object container implementation and function

What are the advantages of the industry private network over the public network? What specific requirements can be met?

JS quick start (II)

Flody的应用

SQL注入漏洞(MSSQL注入)
随机推荐
win10电脑系统里的视频不显示缩略图
The implementation of the maize negotiable digital warehouse receipt standard will speed up the asset digitization process of the industry
IPv6 comprehensive experiment
[HBZ share] reasons for slow addition and deletion of ArrayList and fast query
[detailed steps of FreeRTOS shift value for the first time]
Sqlserver query results are not displayed in tabular form. How to modify them
View workflow
Quick sort
yolov5 tensorrt加速
【LGR-109】洛谷 5 月月赛 II & Windy Round 6
2021robocom robot developer competition (Preliminary)
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
What should the project manager do if there is something wrong with team collaboration?
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
SQL injection vulnerability (MSSQL injection)
word封面下划线
A little knowledge of CPU, disk and memory
Acwing week 58
Lepton 无损压缩原理及性能分析
Postman Association