您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
21 行
779 B
21 行
779 B
using UnityEngine;
|
|
using UnityEngine.VFXToolbox;
|
|
|
|
namespace UnityEditor.VFXToolbox
|
|
{
|
|
[CustomPropertyDrawer(typeof(FloatSliderAttribute))]
|
|
public class FloatSliderPropertyDrawer : PropertyDrawer
|
|
{
|
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
|
{
|
|
FloatSliderAttribute floatSliderAttribute = attribute as FloatSliderAttribute;
|
|
|
|
if(property.propertyType == SerializedPropertyType.Float)
|
|
{
|
|
EditorGUI.Slider(position, property, floatSliderAttribute.m_ValueMin, floatSliderAttribute.m_ValueMax);
|
|
}
|
|
else
|
|
EditorGUI.LabelField(position, label, "(FloatSliderProperty can only be used with float attributes)");
|
|
}
|
|
}
|
|
}
|