当前位置:网站首页>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;
边栏推荐
- 关于Unity Inspector上的一些常用技巧,一般用于编辑器扩展或者其他
- Basic knowledge and examples of binary tree
- The web project imported the MySQL driver jar package but failed to load it into the driver
- 集合详解之 Map + 面试题
- Complete list of common functions of turtle module
- Redis 排查大 key 的4種方法,優化必備
- Visio draw fan
- Postman断言
- A blog to achieve embedded entry
- 饼干(考试版)
猜你喜欢

Is the mode of education together - on campus + off campus reliable

Postman Association

English Vocabulary - life scene memory method

Use sentinel to interface locally

从0到1建设智能灰度数据体系:以vivo游戏中心为例

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

canal同步mysql数据变化到kafka(centos部署)

RTP gb28181 document testing tool

Dry goods collection | Vulkan game engine video tutorial

What are the advantages of the industry private network over the public network? What specific requirements can be met?
随机推荐
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
关于imx8mp的es8316的芯片调试
Canal synchronizes MySQL data changes to Kafka (CentOS deployment)
优秀PM必须经历这3层蜕变!
【LGR-109】洛谷 5 月月赛 II & Windy Round 6
Quick sort
集合详解之 Collection + 面试题
麦斯克电子IPO被终止:曾拟募资8亿 河南资产是股东
Postman关联
11. Intranet penetration and automatic refresh
Summary of redis AOF and RDB knowledge points
Platformio create libopencm3 + FreeRTOS project
[HBZ share] reasons for slow addition and deletion of ArrayList and fast query
[NOIP2008 提高组] 笨小猴
Nestjs配置文件上传, 配置中间件以及管道的使用
[classic example] binary tree recursive structure classic topic collection @ binary tree
行业专网对比公网,优势在哪儿?能满足什么特定要求?
Luogu deep foundation part 1 Introduction to language Chapter 2 sequential structure programming
[try to hack] John hash cracking tool
比尔·盖茨晒18岁个人简历,48年前期望年薪1.2万美元