Attributes
Attributes allow you to create and group UI elements in script inspector with a few lines of code
Add this line to your script to use attributes:
using VInspector;Buttons
Add [Button] attribute before any function to create a button
[Button]
public void SayHelloWorld()
{
Debug.Log("Hello World!");
}
You can customize button name, size and color:
Foldouts
Add [Foldout] before variables to group them into foldouts

Use [EndFoldout] to end foldout sections

Foldouts can be nested

And buttons can be put into foldouts

Tabs
Use [Tab] to create tabs

Use [EndTab] to end tab sections, like [EndFoldout] for foldouts Like foldouts, tabs can be nested and can contain buttons
Show hidden variables
Use [ShowInInspector] to show any variable

Hide and disable variables
Use [HideIf] and [ShowIf] to hide variables depending on other variables

Similarly, use [DisableIf] and [EnableIf] to disable variables

Use [EndIf] to end sections

Variable types other than bool can also be used as conditions
Range sliders
Use [MinMaxSlider] on Vector2 or Vector2Int to create range sliders

Variants
Use [Variants] to create variant selectors

Callback on change
Use [OnValueChanged] to call a function when a variable is edited
Multiple variables can be subscribed to at once
Read-only variables
Use [ReadOnly] to make variables non-editable

Static inspector
Static buttons and static variables with [ShowInInspector] attribute will also appear on script asset
Last updated