脚本常用标签属性

脚本常用标签属性

 

using System;
using UnityEngine;

public class Juse : MonoBehaviour
{
    [HideInInspector]//隐藏变量名
    public GameObject dia;
    [SerializeField]//序列化,显示
    private GameObject cia;
    [Header("TypeOne")]//添加标题组
    public Huse dis;
    [Range(0f, 1f)]//添加滑动条
    public float speed;
    [Space(50)]//设置间隙
    public int des;
    [Tooltip("This is tip")]//变量名提示
    public float gues;
    [TextArea]//扩大输入区域
    public string text;
    public Rise rise;
    
    void Start()
    {
        Debug.Log(rise.kues);
    }
}
[Serializable]//将变量分类
public class Rise
{
    public int jues;
    public float kues;
    public float[] lues;
}

public enum Huse
{
    nianling,
    sex,
    didi,
    ning,
    sea,
    dudi
}

  效果如下:

 

 

[AddComponentMenu("Rendering/Huddes", 1001)]//写在类的上面,可以修改脚本在Inspector中的名字为Huddes

  

#if UNITY_EDITOR
    [CN("相机位置")]
#endif
    public Transform cameraPos;//在Inspector中可以显示:相机位置

  

  

posted @ 2023-06-13 19:13  gatran  阅读(4)  评论(0编辑  收藏  举报