2022-05-20 10:57:25 -04:00
# Tri Inspector [![Github license](https://img.shields.io/github/license/codewriter-packages/Tri-Inspector.svg?style=flat-square)](#) [![Unity 2020.3](https://img.shields.io/badge/Unity-2020.3+-2296F3.svg?style=flat-square)](#) ![GitHub package.json version](https://img.shields.io/github/package-json/v/codewriter-packages/Tri-Inspector?style=flat-square) [![openupm](https://img.shields.io/npm/v/com.codewriter.triinspector?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.codewriter.triinspector/)
2022-05-16 02:35:30 -04:00
2022-01-05 08:14:54 -05:00
_Advanced inspector attributes for Unity_
2022-08-27 09:46:29 -04:00
![Tri-Inspector-Demo ](https://user-images.githubusercontent.com/26966368/187032895-8c41295b-dd82-40ad-80c3-1efaad202732.png )
2022-05-14 03:24:26 -04:00
2022-05-18 14:36:35 -04:00
- [How to Install ](#How-to-Install )
2022-08-27 09:55:29 -04:00
- [Roadmap ](#Roadmap- )
2022-07-03 10:59:35 -04:00
- [Samples ](#Samples )
2022-05-11 08:13:58 -04:00
- [Attributes ](#Attributes )
2022-05-16 02:35:30 -04:00
- [Misc ](#Misc )
- [Validation ](#Validation )
2022-07-04 11:25:11 -04:00
- [Decorators ](#Decorators )
2022-05-16 02:35:30 -04:00
- [Styling ](#Styling )
- [Collections ](#Collections )
- [Conditionals ](#Conditionals )
- [Buttons ](#Buttons )
- [Debug ](#Debug )
- [Groups ](#Groups )
2022-05-18 14:36:35 -04:00
- [Integrations ](#Integrations )
- [Odin Inspector ](#Odin-Inspector )
2022-05-21 04:49:12 -04:00
- [Odin Validator ](#Odin-Validator )
2022-05-11 08:13:58 -04:00
- [License ](#License )
2022-01-05 08:22:07 -05:00
2022-05-18 14:36:35 -04:00
## How to Install
Library distributed as git package ([How to install package from git URL](https://docs.unity3d.com/Manual/upm-ui-giturl.html))
< br > Git URL: `https://github.com/codewriter-packages/Tri-Inspector.git`
2022-06-06 13:27:00 -04:00
After package installation **run the Installer** by double clicking on it.
![TriInspector-Installer ](https://user-images.githubusercontent.com/26966368/172212210-3bbcf6ff-cdc3-4c7c-87c6-d27ab83e271c.png )
2022-05-18 14:36:35 -04:00
2022-06-07 04:41:26 -04:00
## Roadmap ![GitHub Repo stars](https://img.shields.io/github/stars/codewriter-packages/Tri-Inspector?style=social)
2022-08-27 09:55:29 -04:00
Each star ★ on the project page brings new features closer.
You can suggest new features in the [Discussions ](https://github.com/codewriter-packages/Tri-Inspector/discussions ).
2022-06-07 04:41:26 -04:00
2022-07-03 10:59:35 -04:00
## Samples
TriInspector has built-in samples at `Tools/Tri Inspector/Samples` menu.
![Samples ](https://user-images.githubusercontent.com/26966368/177045336-a3fcf438-3e70-45d0-b753-299e577b2010.png )
2022-05-11 08:13:58 -04:00
## Attributes
### Misc
2022-05-16 02:35:30 -04:00
2022-05-11 08:13:58 -04:00
#### ShowInInspector
2022-05-11 12:28:37 -04:00
Shows non-serialized property in the inspector.
2022-05-13 03:51:26 -04:00
![ShowInInspector ](https://user-images.githubusercontent.com/26966368/168230693-a1a389a6-1a3b-4b94-b4b5-0764e88591f4.png )
2022-05-11 08:13:58 -04:00
```csharp
2022-05-13 03:51:26 -04:00
private float _field;
2022-05-11 08:13:58 -04:00
2022-12-09 10:59:33 -05:00
[ShowInInspector]
private bool _myToggle;
2022-05-11 08:13:58 -04:00
[ShowInInspector]
2022-05-13 03:51:26 -04:00
public float ReadOnlyProperty => _field;
2022-05-11 08:13:58 -04:00
[ShowInInspector]
public float EditableProperty
{
2022-05-13 03:51:26 -04:00
get => _field;
set => _field = value;
2022-05-11 08:13:58 -04:00
}
```
2022-08-03 05:22:12 -04:00
#### HideReferencePicker
Tri Inspector by default shows a polymorphic type picker for `[SerializeReference]` and `[ShowInInspector]` . It can be hidden with a `[HideReferencePicker]` attribute.
![HideReferencePicker ](https://user-images.githubusercontent.com/26966368/182633485-a7876052-afd4-40f4-bc6b-be61a04997a4.png )
```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;
}
```
2022-05-11 08:13:58 -04:00
#### PropertyOrder
2022-05-11 12:28:37 -04:00
Changes property order in the inspector.
2022-05-13 03:51:26 -04:00
![PropertyOrder ](https://user-images.githubusercontent.com/26966368/168231223-c6628a8d-0d0a-47c1-8850-dc4e789fa14f.png )
2022-05-11 08:13:58 -04:00
```csharp
2022-05-13 03:51:26 -04:00
public float first;
[PropertyOrder(0)]
public float second;
2022-05-11 08:13:58 -04:00
```
#### ReadOnly
2022-05-13 03:51:26 -04:00
Makes property non-editable in the inspector.
![ReadOnly ](https://user-images.githubusercontent.com/26966368/168231817-948ef153-eb98-42fb-88ad-3e8d17925b43.png )
2022-05-11 12:28:37 -04:00
2022-05-11 08:13:58 -04:00
```csharp
2022-05-11 12:28:37 -04:00
[ReadOnly]
2022-05-13 03:51:26 -04:00
public Vector3 vec;
2022-05-11 08:13:58 -04:00
```
#### OnValueChanged
2022-05-11 12:28:37 -04:00
Invokes callback on property modification.
2022-05-11 08:13:58 -04:00
```csharp
[OnValueChanged(nameof(OnMaterialChanged))]
public Material mat;
private void OnMaterialChanged()
{
Debug.Log("Material changed!");
}
```
2023-02-16 03:17:04 -05:00
#### HideMonoScript
Hides the default Script property in the inspector.
2023-02-16 03:19:33 -05:00
```csharp
[HideMonoScript]
public class NewBehaviour : MonoBehaviour
{
}
```
2022-05-11 12:28:37 -04:00
### Validation
2022-05-16 02:35:30 -04:00
Tri Inspector has some builtin validators such as `missing reference` and `type mismatch` error. Additionally you can mark out your code with validation attributes or even write own validators.
2022-05-11 12:28:37 -04:00
2022-05-13 03:51:26 -04:00
![Builtin-Validators ](https://user-images.githubusercontent.com/26966368/168232996-04de69a5-91c2-45d8-89b9-627b498db2ce.png )
2022-05-11 12:28:37 -04:00
#### Required
2022-05-13 03:51:26 -04:00
![Required ](https://user-images.githubusercontent.com/26966368/168233232-596535b4-bab8-462e-b5d8-7a1c090e5143.png )
2022-05-11 12:28:37 -04:00
```csharp
[Required]
public Material mat;
```
2022-05-11 08:13:58 -04:00
#### ValidateInput
2022-05-13 03:51:26 -04:00
![ValidateInput ](https://user-images.githubusercontent.com/26966368/168233592-b4dcd4d4-88ec-4213-a2e5-667719feb0b8.png )
2022-05-11 08:13:58 -04:00
```csharp
[ValidateInput(nameof(ValidateTexture))]
2022-05-13 03:51:26 -04:00
public Texture tex;
2022-05-11 08:13:58 -04:00
private TriValidationResult ValidateTexture()
{
if (tex == null) return TriValidationResult.Error("Tex is null");
2022-05-13 03:51:26 -04:00
if (!tex.isReadable) return TriValidationResult.Warning("Tex must be readable");
2022-05-11 08:13:58 -04:00
return TriValidationResult.Valid;
}
```
2022-05-19 10:31:43 -04:00
#### InfoBox
![InfoBox ](https://user-images.githubusercontent.com/26966368/169318171-d1a02212-48f1-41d1-b0aa-e2e1b25df262.png )
```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;
```
2022-06-10 08:33:05 -04:00
#### AssetsOnly
![AssetsOnly ](https://user-images.githubusercontent.com/26966368/173064367-3cfb17f7-e050-4fcb-9b0c-f8710f1716e7.png )
```csharp
[AssetsOnly]
public GameObject obj;
```
2022-07-12 06:27:04 -04:00
#### SceneObjectsOnly
![SceneObjectsOnly ](https://user-images.githubusercontent.com/26966368/178470605-618c9796-054f-40bb-9c09-2d9c6f342faf.png )
```csharp
[SceneObjectsOnly]
public GameObject obj;
```
2022-07-04 11:25:11 -04:00
### Decorators
#### Dropdown
2023-04-05 13:26:43 -04:00
![Dropdown ](https://user-images.githubusercontent.com/26966368/230157088-1fec3c38-7046-4fc8-8da1-aca63744ac37.png )
2022-07-04 11:25:11 -04:00
```csharp
[Dropdown(nameof(intValues))]
2023-04-05 13:26:43 -04:00
public int numberDropdown = 123;
2022-07-04 11:25:11 -04:00
[Dropdown(nameof(GetVectorValues))]
2023-04-05 13:26:43 -04:00
public Vector3 vectorDropdown;
2022-07-04 11:25:11 -04:00
private int[] intValues = {1, 2, 3, 4, 5};
private IEnumerable< TriDropdownItem < Vector3 > > GetVectorValues()
{
return new TriDropdownList< Vector3 >
{
{"Zero", Vector3.zero},
{"One/Forward", Vector3.forward},
{"One/Backward", Vector3.back},
};
}
```
2022-07-16 04:28:16 -04:00
#### Scene
![Scene ](https://user-images.githubusercontent.com/26966368/179394466-a9397212-e3bc-40f1-b721-8f7c43aa3048.png )
```csharp
[Scene] public string scene;
```
2023-04-05 13:32:32 -04:00
#### InlineEditor
![InlineEditor ](https://user-images.githubusercontent.com/26966368/168234617-86a7f500-e635-46f8-90f2-5696e5ae7e63.png )
```csharp
[InlineEditor]
public Material mat;
```
2023-03-12 03:27:02 -04:00
#### DisplayAsString
![DisplayAsString ](https://user-images.githubusercontent.com/26966368/224530522-8aa24fbe-4bc7-4290-89d1-d88c5c502e2b.png )
```csharp
[DisplayAsString]
public string[] collection = {"hello", "world"};
```
2022-05-11 08:13:58 -04:00
### Styling
2022-05-16 02:35:30 -04:00
#### Title
![Title ](https://user-images.githubusercontent.com/26966368/168528842-10ba070e-74ab-4377-8f33-7a55609494f4.png )
```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();
```
2022-05-11 08:13:58 -04:00
#### HideLabel
2022-05-16 02:35:30 -04:00
![HideLabel ](https://user-images.githubusercontent.com/26966368/168528934-353f2843-b6ea-4f4f-b56e-24e006eca6ae.png )
2022-05-11 08:13:58 -04:00
```csharp
2022-05-16 02:35:30 -04:00
[Title("Wide Vector")]
[HideLabel]
public Vector3 vector;
[Title("Wide String")]
2022-05-11 08:13:58 -04:00
[HideLabel]
2022-05-16 02:35:30 -04:00
public string str;
2022-05-11 08:13:58 -04:00
```
#### LabelText
2022-05-16 02:35:30 -04:00
![LabelText ](https://user-images.githubusercontent.com/26966368/168529002-8fb17112-f74c-4535-b399-aefdb352f73a.png )
2022-05-11 08:13:58 -04:00
```csharp
2022-05-16 02:35:30 -04:00
[LabelText("Custom Label")]
public int val;
[LabelText("$" + nameof(DynamicLabel))]
public Vector3 vec;
public string DynamicLabel => DateTime.Now.ToShortTimeString();
2022-05-11 08:13:58 -04:00
```
#### LabelWidth
2022-05-16 02:35:30 -04:00
![LabelWidth ](https://user-images.githubusercontent.com/26966368/168529051-c90bce09-92a7-4afd-b961-d19f03e826f3.png )
2022-05-11 08:13:58 -04:00
```csharp
2022-05-16 02:35:30 -04:00
public int defaultWidth;
[LabelWidth(40)]
public int thin;
[LabelWidth(300)]
public int customInspectorVeryLongPropertyName;
2022-05-11 08:13:58 -04:00
```
#### GUIColor
2022-05-16 02:35:30 -04:00
![GUIColor ](https://user-images.githubusercontent.com/26966368/168529122-048cd964-358c-453b-ab3a-aa7137bab4f7.png )
2022-01-05 08:14:54 -05:00
```csharp
2022-05-16 02:35:30 -04:00
[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() { }
2022-05-11 08:13:58 -04:00
```
2022-01-05 08:14:54 -05:00
2022-05-11 08:13:58 -04:00
#### Indent
2022-05-16 02:35:30 -04:00
![Indent ](https://user-images.githubusercontent.com/26966368/168528565-2972221d-2cb3-49f1-8000-a425e4ff6cea.png )
2022-05-11 08:13:58 -04:00
```csharp
2022-05-16 02:35:30 -04:00
[Title("Custom Indent")]
2022-05-11 08:13:58 -04:00
[Indent]
2022-05-16 02:35:30 -04:00
public int a;
2022-05-11 08:13:58 -04:00
2022-05-16 02:35:30 -04:00
[Indent(2)]
public int b;
2022-05-11 08:13:58 -04:00
2022-05-16 02:35:30 -04:00
[Indent(3)]
public int c;
[Indent(4)]
public int d;
2022-05-11 08:13:58 -04:00
```
#### PropertySpace
2022-05-16 02:35:30 -04:00
![PropertySpace ](https://user-images.githubusercontent.com/26966368/168529641-ee61c950-cb15-4a4e-986b-c9fa8c82dd4d.png )
2022-05-11 08:13:58 -04:00
```csharp
2022-05-16 02:35:30 -04:00
[Space, PropertyOrder(0)]
public Vector3 vecField;
[ShowInInspector, PropertyOrder(1)]
[PropertySpace(SpaceBefore = 10, SpaceAfter = 30)]
public Rect RectProperty { get; set; }
[PropertyOrder(2)]
public bool b;
2022-05-11 08:13:58 -04:00
```
#### PropertyTooltip
2022-05-16 02:35:30 -04:00
![PropertyTooltip ](https://user-images.githubusercontent.com/26966368/168530124-95609470-a495-4eb3-9059-f6203ead995f.png )
2022-05-11 08:13:58 -04:00
```csharp
2022-05-16 02:35:30 -04:00
[PropertyTooltip("This is tooltip")]
public Rect rect;
[PropertyTooltip("$" + nameof(DynamicTooltip))]
public Vector3 vec;
public string DynamicTooltip => DateTime.Now.ToShortTimeString();
2022-05-11 08:13:58 -04:00
```
#### InlineProperty
2022-05-13 03:51:26 -04:00
![InlineProperty ](https://user-images.githubusercontent.com/26966368/168234909-1e6bec90-18ed-4d56-91ca-fe09118e1b72.png )
2022-05-11 08:13:58 -04:00
```csharp
2022-05-11 12:28:37 -04:00
public MinMax rangeFoldout;
[InlineProperty(LabelWidth = 40)]
public MinMax rangeInline;
[Serializable]
public class MinMax
{
public int min;
public int max;
}
2022-05-11 08:13:58 -04:00
```
### Collections
#### ListDrawerSettings
2022-05-13 03:51:26 -04:00
2022-05-31 03:47:31 -04:00
![ListDrawerSettings ](https://user-images.githubusercontent.com/26966368/171126103-4fab58a3-db6c-487b-b616-f7aad528e2ab.png )
2022-05-13 03:51:26 -04:00
2022-05-11 08:13:58 -04:00
```csharp
[ListDrawerSettings(Draggable = true,
HideAddButton = false,
HideRemoveButton = false,
2022-05-11 12:28:37 -04:00
AlwaysExpanded = false)]
2022-05-13 03:51:26 -04:00
public List< Material > list;
2022-05-31 03:47:31 -04:00
[ListDrawerSettings(Draggable = false, AlwaysExpanded = true)]
public Vector3[] vectors;
2022-05-11 08:13:58 -04:00
```
2022-05-30 06:15:09 -04:00
#### TableList
2022-05-31 03:47:31 -04:00
![TableList ](https://user-images.githubusercontent.com/26966368/171125460-679fe467-cf01-47e0-8674-b565ee3d4d7e.png )
2022-05-30 06:15:09 -04:00
```csharp
[TableList(Draggable = true,
HideAddButton = false,
HideRemoveButton = false,
AlwaysExpanded = false)]
public List< TableItem > table;
[Serializable]
public class TableItem
{
2022-05-31 03:47:31 -04:00
[Required]
2022-05-30 06:15:09 -04:00
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() { }
}
```
2022-05-11 08:13:58 -04:00
### Conditionals
2022-05-11 13:29:20 -04:00
#### ShowIf
2022-05-16 02:35:30 -04:00
![ShowIf ](https://user-images.githubusercontent.com/26966368/168531065-af5dad6a-8aea-4ca9-9730-da5feac0099a.png )
2022-05-11 13:29:20 -04:00
```csharp
2022-05-16 02:35:30 -04:00
public Material material;
public bool toggle;
public SomeEnum someEnum;
2022-05-11 13:29:20 -04:00
2022-05-16 02:35:30 -04:00
[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 }
2022-05-11 13:29:20 -04:00
```
#### HideIf
2022-05-16 02:35:30 -04:00
2022-05-11 13:29:20 -04:00
```csharp
public bool visible;
[HideIf(nameof(visible))]
public float val;
```
#### EnableIf
2022-05-16 02:35:30 -04:00
2022-05-11 13:29:20 -04:00
```csharp
public bool visible;
[EnableIf(nameof(visible))]
public float val;
```
#### DisableIf
2022-05-16 02:35:30 -04:00
2022-05-11 13:29:20 -04:00
```csharp
public bool visible;
[DisableIf(nameof(visible))]
public float val;
```
2022-05-11 08:13:58 -04:00
#### HideInPlayMode / ShowInPlayMode
2022-05-16 02:35:30 -04:00
2022-05-11 08:13:58 -04:00
```csharp
[HideInPlayMode] [ShowInPlayMode]
```
#### DisableInPlayMode / EnableInPlayMode
2022-05-16 02:35:30 -04:00
2022-05-11 08:13:58 -04:00
```csharp
[DisableInPlayMode] [EnableInPlayMode]
```
#### HideInEditMode / ShowInEditMode
2022-05-16 02:35:30 -04:00
2022-05-11 08:13:58 -04:00
```csharp
[HideInEditMode] [ShowInEditMode]
```
#### DisableInEditMode / EnableInEditMode
2022-05-16 02:35:30 -04:00
2022-05-11 08:13:58 -04:00
```csharp
[DisableInEditMode] [EnableInEditMode]
```
### Buttons
#### Button
2022-05-13 03:51:26 -04:00
![Button ](https://user-images.githubusercontent.com/26966368/168235907-2b5ed6d4-d00b-4cd6-999c-432abd0a2230.png )
2022-05-11 08:13:58 -04:00
```csharp
2022-05-13 03:51:26 -04:00
[Button("Click me!")]
2022-05-11 08:13:58 -04:00
private void DoButton()
2022-01-05 08:14:54 -05:00
{
2022-05-11 08:13:58 -04:00
Debug.Log("Button clicked!");
2022-01-05 08:14:54 -05:00
}
2022-05-11 08:13:58 -04:00
```
2022-05-29 07:00:15 -04:00
#### EnumToggleButtons
2022-05-31 03:47:31 -04:00
![EnumToggleButtons ](https://user-images.githubusercontent.com/26966368/171126422-79d6ba55-7928-4178-9cc9-a807e3cb8b53.png )
2022-05-29 07:00:15 -04:00
```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,
}
```
2022-05-11 08:13:58 -04:00
### Debug
2022-01-05 08:14:54 -05:00
2022-05-11 08:13:58 -04:00
#### ShowDrawerChain
2022-05-16 02:35:30 -04:00
![ShowDrawerChain ](https://user-images.githubusercontent.com/26966368/168531723-5f2b2d7a-a4c1-4727-8ab5-e7b82a52182e.png )
2022-05-11 08:13:58 -04:00
```csharp
[ShowDrawerChain]
2022-05-16 02:35:30 -04:00
[Indent]
[PropertySpace]
[Title("Custom Title")]
[GUIColor(1.0f, 0.8f, 0.8f)]
public Vector3 vec;
2022-05-11 08:13:58 -04:00
```
### Groups
2022-08-18 02:20:59 -04:00
Properties can be grouped in the inspector using the `Group` attribute.
```csharp
[Group("one")] public float a;
[Group("one")] public float b;
[Group("two")] public float c;
[Group("two")] public float d;
public float e;
```
If you have a lot of properties and group attributes take up too much space, then you can combine multiple properties at once using the `GroupNext` attribute.
```csharp
[GroupNext("one")]
public float a;
public float b;
[GroupNext("two")]
public float c;
public float d;
[UnGroupNext]
public float e;
```
2022-07-06 08:45:48 -04:00
#### Box Group
![BoxGroup ](https://user-images.githubusercontent.com/26966368/177552426-8124b445-e235-43a2-9143-dd5d954dd9f8.png )
2022-05-13 03:51:26 -04:00
2022-05-11 08:13:58 -04:00
```csharp
2022-07-06 08:45:48 -04:00
[DeclareBoxGroup("box", Title = "My Box")]
public class BoxGroupSample : ScriptableObject
2022-01-05 08:14:54 -05:00
{
2022-07-06 08:45:48 -04:00
[Group("box")] public int a;
[Group("box")] public bool b;
}
```
2022-01-30 11:16:17 -05:00
2022-11-13 05:38:45 -05:00
#### Foldout Group
![FoldoutGroup ](https://user-images.githubusercontent.com/26966368/201517886-4138ee55-33c2-4a1a-93bc-a3cda7745a4c.png )
```csharp
2022-11-13 06:18:29 -05:00
[DeclareFoldoutGroup("foldout", Title = "$" + nameof(DynamicTitle))]
2022-11-13 05:38:45 -05:00
public class FoldoutGroupSample : ScriptableObject
{
[Group("foldout")] public int a;
[Group("foldout")] public bool b;
2022-11-13 06:18:29 -05:00
public string DynamicTitle => "My Foldout";
2022-11-13 05:38:45 -05:00
}
```
2023-04-09 12:51:22 -04:00
#### Toggle Group
2023-04-09 13:05:46 -04:00
![ToggleGroup ](https://user-images.githubusercontent.com/26966368/230786234-33e9aa51-c9da-4b50-93ca-05e72b54aa07.png )
2023-04-09 12:51:22 -04:00
```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";
}
```
2022-07-06 08:45:48 -04:00
#### Tab Group
2022-01-05 08:14:54 -05:00
2022-07-06 08:45:48 -04:00
![TabGroup ](https://user-images.githubusercontent.com/26966368/177552003-528a4e52-e340-460b-93e6-f56c07ac063b.png )
2022-01-05 08:14:54 -05:00
2022-07-06 08:45:48 -04:00
```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;
}
```
2022-01-21 06:22:51 -05:00
2022-07-06 08:45:48 -04:00
#### Horizontal Group
![HorizontalGroup ](https://user-images.githubusercontent.com/26966368/177551227-9df32c44-9482-4580-8144-5745af806f24.png )
```csharp
[DeclareHorizontalGroup("vars")]
public class HorizontalGroupSample : ScriptableObject
{
[Group("vars")] public int a;
[Group("vars")] public int b;
[Group("vars")] public int c;
}
```
#### Vertical Group
![VerticalGroup ](https://user-images.githubusercontent.com/26966368/177550644-9d0dc2b7-ed18-4d8f-997d-c4fff2c6d6cb.png )
```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() { }
2022-01-05 08:14:54 -05:00
}
```
2022-05-18 14:36:35 -04:00
## Integrations
2022-05-16 02:35:30 -04:00
2022-05-18 14:36:35 -04:00
### Odin Inspector
2022-01-05 08:14:54 -05:00
2022-05-18 14:36:35 -04:00
Tri Inspector is able to work in compatibility mode with Odin Inspector.
In this mode, the primary interface will be drawn by the Odin Inspector. However,
parts of the interface can be rendered by the Tri Inspector.
2022-01-05 08:14:54 -05:00
2022-05-21 04:49:12 -04:00
In order for the interface to be rendered by Tri instead of Odin,
it is necessary to mark classes with `[DrawWithTriInspector]` attribute.
2022-05-13 03:51:26 -04:00
2022-05-25 05:19:29 -04:00
Alternatively, you can mark the entire assembly with an attribute `[assembly:DrawWithTriInspector]`
to draw all types in the assembly using the Tri Inspector.
2022-05-21 04:49:12 -04:00
### Odin Validator
2022-05-18 14:36:35 -04:00
2022-05-21 04:49:12 -04:00
Tri Inspector is integrated with the Odin Validator
so all validation results from Tri attributes will be shown
in the Odin Validator window.
2022-05-18 14:36:35 -04:00
2022-05-21 04:49:12 -04:00
![Odin-Validator-Integration ](https://user-images.githubusercontent.com/26966368/169645537-d8f0b50f-46af-4804-95e8-337ff3b5ae83.png )
2022-05-08 07:21:18 -04:00
2022-01-05 08:14:54 -05:00
## License
2022-07-16 10:46:16 -04:00
Tri-Inspector is [MIT licensed ](./LICENSE.md ).