Remake with actual working code examples. Some self explanatory ones will just be mentioned.
For Use On Properties
Placeholder(string)
[Property, Placeholder( "Placeholder" )]
public string MyProperty { get; set; }
Title(string)
[Property, Title("Title")]
public string MyProperty { get; set; }Description(string)
[Property, Description( "Description Attribute Text" )]
public string MyProperty { get; set; }Category(string) & Group(string)
Grouped together because they functionally do the same thing
[Property, Group( "Group" )]
public string MyProperty { get; set; }
[Property, Category( "Category" )]
public string MySecondProperty { get; set; }ToggleGroup(string GroupName)
Creates a group just like Category & Group with additional toggle value. Note: this does not actually handle any logic in code, Values within a disabled ToggleGroup are still valid values unless you handle them based on the ToggleGroup's Value
Techincally this can be any type but clearly expects a bool
[Property, ToggleGroup( "Toggle" )] // Property Value that dicates if other properties are used
public bool Toggle { get; set; }
[Property, Group( "Toggle" )] // group this into our ToggleGroup attribute
public string MyProperty { get; set; } = "Default String";
Order(int)
Without this properties appear in the editor in the order they are listed in code, with this you can manually place them. Order Attributes with the same order number will still order around other numbers correct but display in code written order within the same group.
[Property, Order( 4 )] //Order 4 Coded First
public string MyProperty { get; set; } = "Default String";
[Property, Order( 4 )] // Order 4 Coded Second
public string MySecondProperty { get; set; }
[Property, Order( 2 )] // Order 2 Coded Third
public string MyThirdProperty { get; set; }
[Property, Order( 1 )] // Order 1 Coded Fourth
public string MyFourthProperty { get; set; }Note that `MyProperty` and `MySecondProperty` are both `Order(4)` so they appear last but display in code order with that order
Range(float min, float max)
converts normal number input into a slider with min and max values. Limits are only respected by the inspector. Manual setting can bypass limits.
[Property, Range(1,2)]
public float MyPropertyFloatVersion { get; set; } = 50; //Apears outside of slider
Step(float)
Limits inspector to only set values of this variable in increments of this number
[Property, Step( 100 )]
public float MyPropertyFloatVersion { get; set; } = 0;
WideMode
Put input field on a newline the full width of inspector
ReadOnly
Make value un-editable in inspector
Text Area
MultiLine Text Input
InputAction
For use on string property. Will display a dropdown containing the names of all input actions for easy selection
FontName
Dropdown of all font names
Feature(string)
Provides tab based grouping
FeatureEnabled(string NameOfTab)
Similar to ToggleGroups, This tab can be added or removed based on the value of the bool
[Property, FeatureEnabled( "FeatureAttribute" )] //Controls if Feature is Enabled
public bool MyProperty { get; set; }
[Property, Feature( "FeatureAttribute" )] // Puts property within feature group
public float MyPropertyFloatVersion { get; set; } = 50;
[Property, Feature( "NormalFeature" )]
public string MySecondProperty { get; set; }
Header(string)
Space(float distance)
Takes an float then adds that much space inbetween the property and the one above it
InfoBox(string Txt, string Icon, EditorTint ColorToDisplay)
Adds an infobox to the inspector
[Property, InfoBox( "InfoBox", "Favorite", EditorTint.Pink )]
public float MyPropertyFloatVersion { get; set; } = 50;
Normal
For use on vectors to provide quick dropdown for setting a normal value
Change
Change(string TargetMethod)
While the type does not matter, will automatically call the class method following `On[PropertyName]Changed` when the value is changed. If provided with a string name argument it will instead call that method on the class when property is changed.
[Property, Change]
public bool MyProperty { get; set; }
protected void OnMyPropertyChanged( int oldvalue, int NewValue )
{
Log.Info( "Change Detected" );
Log.Info( $"Old Value: {oldvalue}" );
Log.Info( $"New Value: {NewValue}" );
}
RequireComponent(string)
Hide
ConVar(string)
must be static field
HideIf(string PropName, object Value)
if string property target matchs objects value hide this property
[Property]
public bool Toggle { get; set; }
[Property, HideIf( "Toggle", true )]
public int MyProperty { get; set; }ShowIf(string PropName, object Value)
Same as HideIf just inverted
Validate(string MethodToCall, string ValidationErrorMsg, LogLevel Severity)
When this property is changed it will call the method named in the first argument, this method needs to return a bool, and will pass in the new properties value to the method. If the validation returns true nothing displays, if false, an Infobox styled with the specific LogLevel will appear above the property.
[Property]
public bool Toggle { get; set; }
[Property, Validate( "SimpleMethod", "ValidateMessage", LogLevel.Warn )]
public int MyProperty { get; set; }
bool SimpleMethod( int Var )
{
if ( Toggle ) { return true; } else { return false; }
}
For Use On Classes
Icon(string Icon, string ForegroundColor, string BackgroundColor)
Adds an Icon beside component name in the inspector
[Icon( "Favorite", "rgb(255,255,255)", "rgb(255,255,255)" )]
public sealed class AttributesTest : Component {}
SelectionBase
GameObjects with this attribute will be selected when one of their child GameObjects are selected, Clicking again on the child will then select the child. This does not affect Hierarchy, only selcting with scene view
Library(string)
I would guess this does more but this acts as alternative name when search for components that does change the display name of it
For Use On Methods
Button(string Txt, string Icon)
[Button( "This is the Button Text", "Favorite" )]
void ButtonCall( int Var )
{
Log.Info( $"{Var}" );
}ConCmd(string)