### Slider Attribute Examples Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Creates sliders for numeric types. Can use fixed min/max values, dynamic references to fields/properties, or auto-clamping. ```csharp [Slider(nameof(_min), nameof(_max))] public int dynamicIntSlider = -6; [Slider(0, nameof(GetMax))] public float dynamicMaxFloatSlider = 4.6f; public Vector2 minMax = new(-10, 10); [Slider(nameof(minMax))] public float dynamicFloatSlider = 1.83f; [Slider(nameof(minMax), autoClamp: true)] public int dynamicIntSliderClamped = 4; private int _min = -20; private int _max = 20; public float GetMax() => 10; ``` -------------------------------- ### MinMaxSlider Attribute Examples Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Generates a slider for Vector2 or Vector2Int, representing a min and max value. Supports fixed or dynamic ranges and auto-clamping. ```csharp [MinMaxSlider(0f, 10f)] public Vector2 fixedMinMaxSlider = new(2f, 4f); [MinMaxSlider(nameof(_min), nameof(_max))] public Vector2Int dynamicIntMinMaxSlider = new(-8, 0); [MinMaxSlider(-20, nameof(GetMax))] public Vector2 dynamicFloatMaxSlider = new(-7.7f, -1.7f); public Vector2 minMax = new(-10, 10); [MinMaxSlider(nameof(minMax))] public Vector2 dynamicFloatMinMaxSlider = new(0, 4); [MinMaxSlider(nameof(minMax), autoClamp: true)] public Vector2Int dynamicIntMinMaxSliderClamped = new(2, 6); private int _min = -20; private int _max = 20; public float GetMax() => 10; ``` -------------------------------- ### Required Get Attribute for Validation Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Use `[RequiredGet]` to automatically find and assign a component. It supports searching in parents, children, and including/excluding the current GameObject. ```csharp [RequiredGet] public Transform myTransform; [RequiredGet(InParents = true)] public Animator animator; // Search for any Animator in parents [RequiredGet(InChildren = true, IncludeSelf = false)] public MeshRenderer[] childrenMeshes; // Search all meshes in children ``` -------------------------------- ### PreviewMesh Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Renders a preview of a GameObject with customizable dimensions and options to hide the foldout or mesh. ```csharp [LabelWidth(270f)] [PreviewMesh(100, 100)] public GameObject meshCustomLengthAndWidth; [LabelWidth(200f)] [PreviewMesh(200, 160, false)] public GameObject meshNoFoldoutNoMesh; [LabelWidth(200f)] [PreviewMesh(200, 160, false)] public GameObject meshNoFoldoutWithMesh; ``` -------------------------------- ### PreviewObject Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Renders a preview of a Texture2D or GameObject directly in the inspector. ```csharp [PreviewObject] public Texture2D texture; [PreviewObject(Height = 100)] public GameObject gameObj; ``` -------------------------------- ### Sequential Grouping with [GroupNext] and [UnGroupNext] Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Employ [GroupNext] to assign subsequent properties to a specified group without repeating the attribute on each. Use [UnGroupNext] to exit sequential grouping. ```csharp [GroupNext("one")] public float a; public float b; [GroupNext("two")] public float c; public float d; [UnGroupNext] public float e; ``` -------------------------------- ### PropertyTooltip Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Assign a tooltip to a property. Supports static strings or dynamic values using string interpolation. ```csharp [PropertyTooltip("This is tooltip")] public Rect rect; [PropertyTooltip("$" + nameof(DynamicTooltip))] public Vector3 vec; public string DynamicTooltip => DateTime.Now.ToShortTimeString(); ``` -------------------------------- ### DisplayAsString Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Displays a collection (like string arrays) as a single string in the inspector. ```csharp [DisplayAsString] public string[] collection = {"hello", "world"}; ``` -------------------------------- ### ShowIf Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Conditionally show fields based on the value of another field, enum, or boolean. Supports checking for null values. ```csharp public Material material; public bool toggle; public SomeEnum someEnum; [ShowIf(nameof(material), null)] public Vector3 showWhenMaterialIsNull; [ShowIf(nameof(toggle))] public Vector3 showWhenToggleIsTrue; [ShowIf(nameof(toggle), false)] public Vector3 showWhenToggleIsFalse; [ShowIf(nameof(someEnum), SomeEnum.Two)] public Vector3 showWhenSomeEnumIsTwo; public enum SomeEnum { One, Two, Three } ``` -------------------------------- ### Drawing with Tri Inspector in Odin Compatibility Mode Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md To have Tri Inspector render parts of the interface while using Odin Inspector, mark specific classes with the [DrawWithTriInspector] attribute. ```csharp using TriInspector; [DrawWithTriInspector] public class MyComponent : MonoBehaviour { // ... component properties ... } ``` -------------------------------- ### Play Mode Visibility Attributes Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Control the visibility of fields during play mode and edit mode. ```csharp [HideInPlayMode] [ShowInPlayMode] ``` ```csharp [DisableInPlayMode] [EnableInPlayMode] ``` ```csharp [HideInEditMode] [ShowInEditMode] ``` ```csharp [DisableInEditMode] [EnableInEditMode] ``` -------------------------------- ### Basic Property Grouping with [Group] Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Use the [Group] attribute to assign properties to named groups in the inspector. Properties without a group attribute appear in their own default group. ```csharp [Group("one")] public float a; [Group("one")] public float b; [Group("two")] public float c; [Group("two")] public float d; public float e; ``` -------------------------------- ### EnableIf Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Conditionally enable or disable fields based on the value of another boolean field. ```csharp public bool visible; [EnableIf(nameof(visible))] public float val; ``` -------------------------------- ### ShowDrawerChain Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Displays the chain of drawers applied to a field, useful for debugging inspector behavior. ```csharp [ShowDrawerChain] [Indent] [PropertySpace] [Title("Custom Title")] [GUIColor(1.0f, 0.8f, 0.8f)] public Vector3 vec; ``` -------------------------------- ### Drawing Entire Assembly with Tri Inspector Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md To force Tri Inspector to render all types within an assembly, apply the [assembly:DrawWithTriInspector] attribute at the assembly level. ```csharp [assembly: DrawWithTriInspector] ``` -------------------------------- ### GUIColor Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Apply a background color to fields, buttons, or other inspector elements. Supports RGB values. ```csharp [GUIColor(0.8f, 1.0f, 0.6f)] public Vector3 vec; [GUIColor(0.6f, 0.9f, 1.0f)] [Button] public void BlueButton() { } [GUIColor(1.0f, 0.6f, 0.6f)] [Button] public void RedButton() { } ``` -------------------------------- ### Button Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Create clickable buttons in the inspector to trigger methods. Supports custom labels and parameters. ```csharp [Button("Click me!")] private void Button() => Debug.Log("Button clicked!"); [Button(ButtonSizes.Large)] private void ButtonWithParameters(Vector3 vec, string str = "default value") { Debug.Log($"Button with parameters: {vec} {str}"); } ``` -------------------------------- ### PropertySpace Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Add vertical spacing before and after a property in the inspector. Useful for visual grouping. ```csharp [Space, PropertyOrder(0)] public Vector3 vecField; [ShowInInspector, PropertyOrder(1)] [PropertySpace(SpaceBefore = 10, SpaceAfter = 30)] public Rect RectProperty { get; set; } [PropertyOrder(2)] public bool b; ``` -------------------------------- ### ListDrawerSettings Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Customize the appearance and behavior of list and array drawers. Options include draggable, add/remove buttons, and expansion state. ```csharp [ListDrawerSettings(Draggable = true, HideAddButton = false, HideRemoveButton = false, AlwaysExpanded = false)] public List list; [ListDrawerSettings(Draggable = false, AlwaysExpanded = true)] public Vector3[] vectors; ``` -------------------------------- ### Tab Group Declaration and Usage Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Define tabs using [DeclareTabGroup] and assign properties to specific tabs with the [Tab] attribute. Each [Tab] attribute specifies the name of the tab. ```csharp [DeclareTabGroup("tabs")] public class TabGroupSample : ScriptableObject { [Group("tabs"), Tab("One")] public int a; [Group("tabs"), Tab("Two")] public float b; [Group("tabs"), Tab("Three")] public bool c; } ``` -------------------------------- ### Toggle Group Declaration and Usage Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Create a toggleable group with [DeclareToggleGroup]. Properties within this group are only visible when the toggle is active. The title can be dynamic. ```csharp [DeclareToggleGroup("toggle", Title = "$" + nameof(DynamicTitle))] public class ToggleGroupSample : ScriptableObject { [Group("toggle")] public bool enabled; [Group("toggle")] public int a; [Group("toggle")] public bool b; public string DynamicTitle => "My Toggle"; } ``` -------------------------------- ### TableList Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Renders a list as a table in the inspector, with support for columns, buttons, and custom item classes. ```csharp [TableList(Draggable = true, HideAddButton = false, HideRemoveButton = false, AlwaysExpanded = false)] public List table; [Serializable] public class TableItem { [Required] public Texture icon; public string description; [Group("Combined"), LabelWidth(16)] public string A, B, C; [Button, Group("Actions")] public void Test1() { } [Button, Group("Actions")] public void Test2() { } } ``` -------------------------------- ### InlineEditor Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Allows editing of a Material directly within the inspector. ```csharp [InlineEditor] public Material mat; ``` -------------------------------- ### Unit Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Applies a unit of measurement to a float field. Supports predefined units like meters or custom text. ```csharp [Unit(UnitAttribute.Meter)] public float lengthInMeters; [Unit("My custom Unit")] public float freeTextUnit; ``` -------------------------------- ### Title Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Sets a custom title for a field or a button in the inspector. Titles can be static strings or dynamically generated. ```csharp [Title("My Title")] public string val; [Title("$" + nameof(_myTitleField))] public Rect rect; [Title("$" + nameof(MyTitleProperty))] public Vector3 vec; [Title("Button Title")] [Button] public void MyButton() { } private string _myTitleField = "Serialized Title"; private string MyTitleProperty => DateTime.Now.ToLongTimeString(); ``` -------------------------------- ### Layer Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Specifies that an integer field should be represented as a layer selection in the inspector. ```csharp [Layer] public int layer; ``` -------------------------------- ### Foldout Group Declaration and Usage Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Use [DeclareFoldoutGroup] to create a collapsible foldout section. Properties are assigned using the [Group] attribute. The title can be dynamic. ```csharp [DeclareFoldoutGroup("foldout", Title = "$" + nameof(DynamicTitle))] public class FoldoutGroupSample : ScriptableObject { [Group("foldout")] public int a; [Group("foldout")] public bool b; public string DynamicTitle => "My Foldout"; } ``` -------------------------------- ### MaterialProperty Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Displays valid shader properties from a Material. Supports specific types like Float, Color, Vector, and Texture. ```csharp [MaterialProperty(nameof(material))] public string propertyName; [MaterialProperty(nameof(material), ShaderPropertyType.Color)] public int propertyHash; public Material material; ``` -------------------------------- ### Box Group Declaration and Usage Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Declare a box group using [DeclareBoxGroup] and assign properties to it with the [Group] attribute. This creates a visually distinct boxed area in the inspector. ```csharp [DeclareBoxGroup("box", Title = "My Box")] public class BoxGroupSample : ScriptableObject { [Group("box")] public int a; [Group("box")] public bool b; } ``` -------------------------------- ### Dropdown Attribute for Properties Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md The `[Dropdown]` attribute provides a dropdown list for a property, populated either by a static array or a method returning `TriDropdownItem` objects. ```csharp [Dropdown(nameof(intValues))] public int numberDropdown = 123; [Dropdown(nameof(GetVectorValues))] public Vector3 vectorDropdown; private int[] intValues = {1, 2, 3, 4, 5}; private IEnumerable> GetVectorValues() { return new TriDropdownList { {"Zero", Vector3.zero}, {"One/Forward", Vector3.forward}, {"One/Backward", Vector3.back}, }; } ``` -------------------------------- ### Info Box Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md The `[InfoBox]` attribute displays a message in the inspector. It supports different message types (None, Info, Warning, Error) and can be dynamically updated. ```csharp [Title("InfoBox Message Types")] [InfoBox("Default info box")] public int a; [InfoBox("None info box", TriMessageType.None)] public int b; [InfoBox("Warning info box", TriMessageType.Warning)] public int c; [InfoBox("Error info box", TriMessageType.Error)] public int d; [InfoBox("$" + nameof(DynamicInfo), visibleIf: nameof(VisibleInEditMode))] public Vector3 vec; private string DynamicInfo => "Dynamic info box: " + DateTime.Now.ToLongTimeString(); private bool VisibleInEditMode => !Application.isPlaying; ``` -------------------------------- ### Scene Attribute for String Fields Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md The `[Scene]` attribute is used on a string field to allow selection of a scene from the build settings within the inspector. ```csharp [Scene] public string scene; ``` -------------------------------- ### Property Order Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md The `[PropertyOrder]` attribute allows you to change the order of properties displayed in the inspector. Lower values appear earlier. ```csharp public float first; [PropertyOrder(0)] public float second; ``` -------------------------------- ### Indent Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Control the indentation level of fields in the inspector. Accepts an integer for custom indentation. ```csharp [Title("Custom Indent")] [Indent] public int a; [Indent(2)] public int b; [Indent(3)] public int c; [Indent(4)] public int d; ``` -------------------------------- ### LabelText Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Sets custom text for a field's label in the inspector. The label text can be static or dynamically generated. ```csharp [LabelText("Custom Label")] public int val; [LabelText("$" + nameof(DynamicLabel))] public Vector3 vec; public string DynamicLabel => DateTime.Now.ToShortTimeString(); ``` -------------------------------- ### Assets Only Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Use `[AssetsOnly]` to restrict the assignment of a field to only assets that exist within the project's Assets folder, excluding scene objects. ```csharp [AssetsOnly] public GameObject obj; ``` -------------------------------- ### Display Custom Structs Inline in Unity Inspector Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md The `InlineProperty` attribute allows you to display custom structs or classes directly within the inspector, without expanding them into a nested object. You can also customize the label width for these inline properties. ```csharp public MinMax rangeFoldout; [InlineProperty(LabelWidth = 40)] public MinMax rangeInline; [Serializable] public class MinMax { public int min; public int max; } ``` -------------------------------- ### Read Only Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Apply the `[ReadOnly]` attribute to make a property non-editable within the Unity inspector. ```csharp [ReadOnly] public Vector3 vec; ``` -------------------------------- ### LabelWidth Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Adjusts the width of the label for a field in the inspector. Useful for aligning labels or accommodating long names. ```csharp public int defaultWidth; [LabelWidth(40)] public int thin; [LabelWidth(300)] public int customInspectorVeryLongPropertyName; ``` -------------------------------- ### Horizontal Group Declaration and Usage Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Arrange properties horizontally using [DeclareHorizontalGroup]. Properties assigned to this group will be laid out side-by-side. ```csharp [DeclareHorizontalGroup("vars")] public class HorizontalGroupSample : ScriptableObject { [Group("vars")] public int a; [Group("vars")] public int b; [Group("vars")] public int c; } ``` -------------------------------- ### Show Non-Serialized Fields in Unity Inspector Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Use the `ShowInInspector` attribute to display fields and properties that are not marked as `[SerializeField]` or are read-only properties in the Unity Inspector. This is useful for debugging or displaying calculated values. ```csharp private float _field; [ShowInInspector] private bool _myToggle; [ShowInInspector] public float ReadOnlyProperty => _field; [ShowInInspector] public float EditableProperty { get => _field; set => _field = value; } ``` -------------------------------- ### Scene Objects Only Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md The `[SceneObjectsOnly]` attribute ensures that a field can only be assigned objects that are present in the current scene, not project assets. ```csharp [SceneObjectsOnly] public GameObject obj; ``` -------------------------------- ### HideIf Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Conditionally hide fields based on the value of another boolean field. ```csharp public bool visible; [HideIf(nameof(visible))] public float val; ``` -------------------------------- ### HideLabel Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Hides the label for a field, making it appear directly without a preceding name. Useful for wide fields. ```csharp [Title("Wide Vector")] [HideLabel] public Vector3 vector; [Title("Wide String")] [HideLabel] public string str; ``` -------------------------------- ### EnumToggleButtons Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Display enum values as toggle buttons for easier selection. Supports regular enums and flags. ```csharp [EnumToggleButtons] public SomeEnum someEnum; [EnumToggleButtons] public SomeFlags someFlags; public enum SomeEnum { One, Two, Three } [Flags] public enum SomeFlags { A = 1 << 0, B = 1 << 1, C = 1 << 2, AB = A | B, BC = B | C, } ``` -------------------------------- ### Hide Mono Script Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Use `[HideMonoScript]` to hide the default 'Script' property that appears for `MonoBehaviour` components in the inspector. ```csharp [HideMonoScript] public class NewBehaviour : MonoBehaviour { } ``` -------------------------------- ### Validate Input Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md The `[ValidateInput]` attribute allows you to define custom validation logic for a property by specifying a callback method that returns a `TriValidationResult`. ```csharp [ValidateInput(nameof(ValidateTexture))] public Texture tex; private TriValidationResult ValidateTexture() { if (tex == null) return TriValidationResult.Error("Tex is null"); if (!tex.isReadable) return TriValidationResult.Warning("Tex must be readable"); return TriValidationResult.Valid; } ``` -------------------------------- ### Vertical Group Declaration and Usage Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Nest vertical groups within horizontal groups using [DeclareVerticalGroup]. This allows for complex layouts combining horizontal and vertical arrangements of properties and buttons. ```csharp [DeclareHorizontalGroup("horizontal")] [DeclareVerticalGroup("horizontal/vars")] [DeclareVerticalGroup("horizontal/buttons")] public class VerticalGroupSample : ScriptableObject { [Group("horizontal/vars")] public float a; [Group("horizontal/vars")] public float b; [Button, Group("horizontal/buttons")] public void ButtonA() { } [Button, Group("horizontal/buttons")] public void ButtonB() { } } ``` -------------------------------- ### AnimatorParameter Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Automatically lists available Animator parameters. Filter by type using AnimatorControllerParameterType. ```csharp [AnimatorParameter(nameof(animator))] public string parameterName; [AnimatorParameter(nameof(animator), AnimatorControllerParameterType.Float)] public int parameterHash; public Animator animator; ``` -------------------------------- ### DisableIf Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Conditionally disable fields based on the value of another boolean field. ```csharp public bool visible; [DisableIf(nameof(visible))] public float val; ``` -------------------------------- ### On Value Changed Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md The `[OnValueChanged]` attribute invokes a specified callback method whenever the property's value is modified in the inspector. ```csharp [OnValueChanged(nameof(OnMaterialChanged))] public Material mat; private void OnMaterialChanged() { Debug.Log("Material changed!"); } ``` -------------------------------- ### Hide Reference Picker Attribute Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md Use `[HideReferencePicker]` to prevent the polymorphic type picker from showing for `[SerializeReference]` and `[ShowInInspector]` fields. ```csharp [SerializeReference] public MyReferenceClass clazz1 = new MyReferenceClass(); [SerializeReference, HideReferencePicker] public MyReferenceClass clazz2 = new MyReferenceClass(); [ShowInInspector, HideReferencePicker] public MyReferenceClass Clazz3 { get; set; } = new MyReferenceClass(); [Serializable] public class MyReferenceClass { public int inner; } ``` -------------------------------- ### Required Attribute for Validation Source: https://github.com/codewriter-packages/tri-inspector/blob/main/README.md The `[Required]` attribute ensures a field is not null. It can optionally specify a `FixAction` to automatically resolve missing references. ```csharp [Required] public Material material; [Required(FixAction = nameof(FixTarget), FixActionName = "Assign self")] public Transform target; private void FixTarget() { target = GetComponent(); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.