当前位置:网站首页>Editor extensions in unity
Editor extensions in unity
2022-07-05 22:28:00 【M.JH】
Catalog
1.RequireComponent
effect : You can ensure that the object on which the script is mounted contains the specified components
usage :
[RequireComponent(typeof(BoxCollider))]
public class Test : MonoBehaviour
{
// Ensure that the attached objects have BoxCollider Components
}
2.AddComponentMenu
effect : You can add a new category when adding components
usage :
[AddComponentMenu(“MJH/Test”)]
public class Test : MonoBehaviour
{
}
3.CreateAssetMenu
effect : You can create objects in file resources , General coordination ScriptObject Use it together
usage :
[CreateAssetMenu(fileName =“My Object”,menuName = “ScriptableObject/NewTab”, order = 1)]
public class Test : ScriptableObject
{
}
4.DisallowMultipleComponent
effect : Prevent us from adding scripts to the same object repeatedly
usage :
[DisallowMultipleComponent]
public class Test : MonoBehaviour
{
}
5.SerializeField
effect : You can serialize fields on the editor , Let developers assign values to fields in the editor
usage :
public class Test : MonoBehaviour
{
[SerializeField] private string str;
}
6.System.Serializable
effect : You can serialize structures or classes on the editor , Let developers assign values to fields in the editor
usage :
public class Test : MonoBehaviour
{
public PlayerStats playerStats;
[System.Serializable] public struct PlayerStats
{
public int a;
public int b;
public bool YN;
}
}
7.HideInInspector
effect : Public fields can be hidden Do not serialize the display on the editor
usage :
public class Test : MonoBehaviour
{
[HideInInspector] public string str;
}
8.Tooltip
effect : You can add hints for fields in the editor
usage :
public class Test : MonoBehaviour
{
[Tooltip(“ Player name ”)]
public string PlayerName;
}
9.Multiline
effect : You can enlarge the field input box in the editor
usage :
public class Test : MonoBehaviour
{
[Multiline(4)]
public string PlayerName;
}
10.Space
effect : You can adjust the spacing between fields in the editor
usage :
public class Test : MonoBehaviour
{
public string PlayerName;
[Space(50)]
public string EnemyName;
}
11.TextArea
effect : Add a slider that pulls up and down for the editor field input box
usage :
public class Test : MonoBehaviour
{
[TextArea]
public string PlayerName;
}
12.Header
effect : Add a dividing line in the editor
usage :
public class Test : MonoBehaviour
{
[Header(“Player Setting”)]
public string PlayerName;
public int PlayerHp;
[Header(“UI Setting”)]
public string UIsetting;
public string UI2setting;
}
13.Range
effect : Add a range to the variable
usage :
public class Test : MonoBehaviour
{
[Range(0, 1)] public float Speed;
}
14.Min
effect : Set the minimum value of the variable
usage :
public class Test : MonoBehaviour
{
[Min(0)] public float Speed;
}
15.ContextMenu
effect : Execute the function when it is not running , For example, functions such as restoring the position of objects
usage :
public class Test : MonoBehaviour
{
[SerializeField] private GameObject ball;
[ContextMenu(“Do things”)]
public void ResetBall()
{
ball.transform.position = Vector3.zero;
}
}
边栏推荐
- EasyCVR集群部署如何解决项目中的海量视频接入与大并发需求?
- A substring with a length of three and different characters in the leetcode simple question
- 50. Pow(x, n). O(logN) Sol
- [error record] groovy function parameter dynamic type error (guess: groovy.lang.missingmethodexception: no signature of method)
- 90后测试员:“入职阿里,这一次,我决定不在跳槽了”
- Promql demo service
- Performance monitoring of database tuning solutions
- Oracle views the data size of a table
- Thinkphp5.1 cross domain problem solving
- Nacos 的安装与服务的注册
猜你喜欢

Business learning of mall order module

How can Bluetooth in notebook computer be used to connect headphones

Serializability of concurrent scheduling

Interview questions for famous enterprises: Coins represent a given value

Blocking protocol for concurrency control

Metaverse Ape获Negentropy Capital种子轮融资350万美元

Solutions for unexplained downtime of MySQL services

Nacos installation and service registration
![[error record] groovy function parameter dynamic type error (guess: groovy.lang.missingmethodexception: no signature of method)](/img/3e/34b45cd14f0302bb381efd244bc68f.jpg)
[error record] groovy function parameter dynamic type error (guess: groovy.lang.missingmethodexception: no signature of method)

2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
随机推荐
二叉树(二)——堆的代码实现
CA certificate trampled pit
Recovery technology with checkpoints
What changes has Web3 brought to the Internet?
元宇宙中的三大“派系”
Leetcode simple question: find the nearest point with the same X or Y coordinate
Cobaltstrike builds an intranet tunnel
QT creator 7-cmake update
MCU case -int0 and INT1 interrupt count
How to develop and introduce applet plug-ins
Hcip day 16
FBO and RBO disappeared in webgpu
Server optimization of performance tuning methodology
Blocking protocol for concurrency control
U盘的文件无法删除文件怎么办?Win11无法删除U盘文件解决教程
Draw a red lantern with MATLAB
GWT module may need to be (RE) compiled reduce - GWT module may need to be (RE) compiled reduce
C language - structural basis
笔记本电脑蓝牙怎么用来连接耳机
Technology cloud report won the special contribution award for the 10th anniversary of 2013-2022 of the "cloud Ding Award" of the global cloud computing conference













