blob: c5365b736f0de29f2e09b3ade7aa8444b4232e6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using UnityEngine;
using System;
using System.Collections;
using AdvancedInspector;
[AdvancedInspector]
public class AIExample20_RangeValue : MonoBehaviour
{
// Unity already have a RangeAttribute.
// However, this [Range] can only be applied on fields.
[Inspect, RangeValue(0, 10)]
public float myField;
// However, the RangeValue attribute can also be applied on property.
[Inspect, RangeValue(0, 10)]
public float MyProperty
{
get { return myField; }
set { myField = value; }
}
// Unity's range attribute also works, but cannot be applied to properties.
[Inspect, Range(0, 10)]
public float unityRange;
}
|