summaryrefslogtreecommitdiff
path: root/Runtime/Export/PropertyAttribute.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Export/PropertyAttribute.cs')
-rw-r--r--Runtime/Export/PropertyAttribute.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/Runtime/Export/PropertyAttribute.cs b/Runtime/Export/PropertyAttribute.cs
new file mode 100644
index 0000000..f008483
--- /dev/null
+++ b/Runtime/Export/PropertyAttribute.cs
@@ -0,0 +1,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;
+ }
+
+}
+
+}