mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 08:18:49 -05:00
Readme
This commit is contained in:
parent
cc3b1b1118
commit
9cd81f72dd
62
README.md
62
README.md
@ -3,6 +3,7 @@ _Advanced inspector attributes for Unity_
|
|||||||
|
|
||||||
- [Attributes](#Attributes)
|
- [Attributes](#Attributes)
|
||||||
- [Misc](#Misc)
|
- [Misc](#Misc)
|
||||||
|
- [Validation](#Validation)
|
||||||
- [Styling](#Styling)
|
- [Styling](#Styling)
|
||||||
- [Collections](#Collections)
|
- [Collections](#Collections)
|
||||||
- [Conditionals](#Conditionals)
|
- [Conditionals](#Conditionals)
|
||||||
@ -20,6 +21,9 @@ _Advanced inspector attributes for Unity_
|
|||||||
|
|
||||||
### Misc
|
### Misc
|
||||||
#### ShowInInspector
|
#### ShowInInspector
|
||||||
|
|
||||||
|
Shows non-serialized property in the inspector.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
private float field;
|
private float field;
|
||||||
|
|
||||||
@ -35,21 +39,25 @@ public float EditableProperty
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### PropertyOrder
|
#### PropertyOrder
|
||||||
|
|
||||||
|
Changes property order in the inspector.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
[PropertyOrder(1)]
|
[PropertyOrder(1)]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### ReadOnly
|
#### ReadOnly
|
||||||
|
|
||||||
|
Makes property non-editable.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
[ReadOnly]
|
[ReadOnly]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Required
|
|
||||||
```csharp
|
|
||||||
[Required]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### OnValueChanged
|
#### OnValueChanged
|
||||||
|
|
||||||
|
Invokes callback on property modification.
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
[OnValueChanged(nameof(OnMaterialChanged))]
|
[OnValueChanged(nameof(OnMaterialChanged))]
|
||||||
public Material mat;
|
public Material mat;
|
||||||
@ -60,6 +68,21 @@ private void OnMaterialChanged()
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Validation
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
![Builtin](https://user-images.githubusercontent.com/26966368/167894126-ac5b4722-c930-4304-b183-4b8cc461f083.png)
|
||||||
|
#### Required
|
||||||
|
```csharp
|
||||||
|
[Required]
|
||||||
|
public Material mat;
|
||||||
|
```
|
||||||
|
|
||||||
|
![Required](https://user-images.githubusercontent.com/26966368/167895375-a1c31812-081f-4033-b7e4-a0c3c43963f0.png)
|
||||||
|
|
||||||
#### ValidateInput
|
#### ValidateInput
|
||||||
```csharp
|
```csharp
|
||||||
[ValidateInput(nameof(ValidateTexture))]
|
[ValidateInput(nameof(ValidateTexture))]
|
||||||
@ -73,12 +96,15 @@ private TriValidationResult ValidateTexture()
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
![ValidateInput](https://user-images.githubusercontent.com/26966368/167895864-cb181383-6f23-4f7f-8c3b-b683760e1d8a.png)
|
||||||
|
|
||||||
### Styling
|
### Styling
|
||||||
|
|
||||||
#### HideLabel
|
#### HideLabel
|
||||||
```csharp
|
```csharp
|
||||||
[HideLabel]
|
[HideLabel]
|
||||||
```
|
```
|
||||||
|
![HideLabel](https://user-images.githubusercontent.com/26966368/167896272-577cbc8f-95be-4b75-97b6-b67d58eba4d1.png)
|
||||||
|
|
||||||
#### LabelText
|
#### LabelText
|
||||||
```csharp
|
```csharp
|
||||||
@ -108,8 +134,11 @@ private TriValidationResult ValidateTexture()
|
|||||||
#### Title
|
#### Title
|
||||||
```csharp
|
```csharp
|
||||||
[Title("My Title")]
|
[Title("My Title")]
|
||||||
|
public int val;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
![Title](https://user-images.githubusercontent.com/26966368/167898501-24a8c472-08b1-4010-b00e-ef7dcc33dfae.png)
|
||||||
|
|
||||||
#### Header
|
#### Header
|
||||||
```csharp
|
```csharp
|
||||||
[Header("My Header")]
|
[Header("My Header")]
|
||||||
@ -129,13 +158,28 @@ private TriValidationResult ValidateTexture()
|
|||||||
#### InlineEditor
|
#### InlineEditor
|
||||||
```csharp
|
```csharp
|
||||||
[InlineEditor]
|
[InlineEditor]
|
||||||
|
public Material mat;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
![InlineEditor](https://user-images.githubusercontent.com/26966368/167896721-79724d1c-570f-4e01-b3e1-8c83aacca661.png)
|
||||||
|
|
||||||
#### InlineProperty
|
#### InlineProperty
|
||||||
```csharp
|
```csharp
|
||||||
[InlineProperty]
|
public MinMax rangeFoldout;
|
||||||
|
|
||||||
|
[InlineProperty(LabelWidth = 40)]
|
||||||
|
public MinMax rangeInline;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class MinMax
|
||||||
|
{
|
||||||
|
public int min;
|
||||||
|
public int max;
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
![InlineProperty](https://user-images.githubusercontent.com/26966368/167899261-6a3ceeda-609e-47d0-b8a0-38f4331cc9f9.png)
|
||||||
|
|
||||||
### Collections
|
### Collections
|
||||||
|
|
||||||
#### ListDrawerSettings
|
#### ListDrawerSettings
|
||||||
@ -143,9 +187,11 @@ private TriValidationResult ValidateTexture()
|
|||||||
[ListDrawerSettings(Draggable = true,
|
[ListDrawerSettings(Draggable = true,
|
||||||
HideAddButton = false,
|
HideAddButton = false,
|
||||||
HideRemoveButton = false,
|
HideRemoveButton = false,
|
||||||
AlwaysExpanded = true]
|
AlwaysExpanded = false)]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
![ListDrawerSettings](https://user-images.githubusercontent.com/26966368/167897095-cde06fdb-8b4c-422c-92dc-8ed781006c6e.png)
|
||||||
|
|
||||||
### Conditionals
|
### Conditionals
|
||||||
|
|
||||||
#### HideInPlayMode / ShowInPlayMode
|
#### HideInPlayMode / ShowInPlayMode
|
||||||
@ -179,6 +225,8 @@ private void DoButton()
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
![Button](https://user-images.githubusercontent.com/26966368/167897368-79fdb050-a2f3-4c37-be3f-54f10f46880e.png)
|
||||||
|
|
||||||
### Debug
|
### Debug
|
||||||
|
|
||||||
#### ShowDrawerChain
|
#### ShowDrawerChain
|
||||||
|
Loading…
Reference in New Issue
Block a user