diff options
author | chai <chaifix@163.com> | 2020-10-15 07:04:38 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-10-15 07:04:38 +0800 |
commit | b71d5611db087772179505ed10c82ca958900df7 (patch) | |
tree | 5160f6af41d45529e435550879e0c87ea59c09a8 /Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample13_Expandable.cs | |
parent | b1b14c45ce95dcf7b81867d68d6006345d98959e (diff) |
+advanced inspector
Diffstat (limited to 'Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample13_Expandable.cs')
-rw-r--r-- | Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample13_Expandable.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample13_Expandable.cs b/Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample13_Expandable.cs new file mode 100644 index 00000000..41e3a722 --- /dev/null +++ b/Assets/ThirdParty/AdvancedInspector/Examples/CSharp/AIExample13_Expandable.cs @@ -0,0 +1,39 @@ +using UnityEngine; +using System; +using System.Collections; + +using AdvancedInspector; + +[AdvancedInspector] +public class AIExample13_Expandable : MonoBehaviour +{ + // The expandable attribute is used to control if an item can not be expanded, or if it should be expanded by default. + [Inspect, Expandable(Expanded = true)] + public ExpandableClass expandedField; + + // Preventing an object from being expandable is sometime useful when you want to display its inner content differently. + [Inspect, Expandable(Expandable = false)] + public ExpandableClass notExpandableField; + + // This class is not expandable by default. + [Inspect] + public NotExpandableClass notExpandableObject; + + // Class with the AdvancedInspector attribute are automaticly inlinable/expandable. + [AdvancedInspector, Serializable] + public class ExpandableClass + { + [Inspect] + public float myField; + } + + // It is possible to prevent that like this; + // This is useful when you build your own base type similar to how a float is displayed. + // A good example is the Guid class. + [AdvancedInspector(Expandable = false), Serializable] + public class NotExpandableClass + { + [Inspect] + public float myField; + } +} |