去掉obi,使用自写绳索
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Obi{
|
||||
|
||||
[System.AttributeUsage(System.AttributeTargets.Field)]
|
||||
public class MinMaxAttribute : MultiPropertyAttribute
|
||||
{
|
||||
float min;
|
||||
float max;
|
||||
public MinMaxAttribute(float min, float max)
|
||||
{
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (property.propertyType == SerializedPropertyType.Vector2){
|
||||
float minValue = property.vector2Value.x;
|
||||
float maxValue = property.vector2Value.y;
|
||||
|
||||
EditorGUI.MinMaxSlider(position, label, ref minValue, ref maxValue, min, max);
|
||||
|
||||
var vec = Vector2.zero;
|
||||
vec.x = minValue;
|
||||
vec.y = maxValue;
|
||||
|
||||
property.vector2Value = vec;
|
||||
}else{
|
||||
EditorGUI.LabelField(position, label.text, "Use MinMaxAttribute with Vector2.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user