summaryrefslogtreecommitdiff
path: root/Runtime/Export/PropertyAttribute.cs
blob: f008483e23e0b4811c0ceb55558f9e19c765ba50 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;

namespace UnityEngine
{

// Base class to derive custom property attributes from. Use this to create custom attributes for script variables.
[System.AttributeUsage (AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public abstract class PropertyAttribute : Attribute
{
}

// Attribute used to make a float or int variable in a script be restricted to a specific range.
[System.AttributeUsage (AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public sealed class RangeAttribute : PropertyAttribute
{
	public readonly float min;
	public readonly float max;
	
	// Attribute used to make a float or int variable in a script be restricted to a specific range.
	public RangeAttribute (float min, float max)
	{
		this.min = min;
		this.max = max;
	}
}


// Attribute to make a string be edited with a multi-line textfield
[System.AttributeUsage (AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public sealed class MultilineAttribute : PropertyAttribute
{
	public readonly int lines;
	
	public MultilineAttribute ()
	{
		this.lines = 3;
	}
	// Attribute used to make a string value be shown in a multiline textarea.
	public MultilineAttribute (int lines)
	{
		this.lines = lines;
	}
	
}

}