blob: 53a532ffd2c5d710eba371cc8d714f221fa038d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
using UnityEngine;
using UnityEditor;
using BehaviorDesigner.Runtime;
using BehaviorDesigner.Runtime.ObjectDrawers;
namespace BehaviorDesigner.Editor.ObjectDrawers
{
[CustomObjectDrawer(typeof(IntSliderAttribute))]
public class IntSliderDrawer : ObjectDrawer
{
public override void OnGUI(GUIContent label)
{
var intSliderAttribute = (IntSliderAttribute)attribute;
if (value is SharedInt) {
var sharedFloat = value as SharedInt;
sharedFloat.Value = EditorGUILayout.IntSlider(label, sharedFloat.Value, intSliderAttribute.min, intSliderAttribute.max);
} else {
value = EditorGUILayout.IntSlider(label, (int)value, intSliderAttribute.min, intSliderAttribute.max);
}
}
}
}
|