Infohazard.Core 1.4.1
Infohazard Core Utility Library
Loading...
Searching...
No Matches
Infohazard.Core.ExpandableAttribute Class Reference

Attribute that enables editing properties of a referenced object. More...

Public Member Functions

 ExpandableAttribute (bool alwaysExpanded=false, string savePath=null, bool showNewButton=true, bool showChildTypes=false, params Type[] requiredInterfaces)
 Construct a new ExpandableAttribute. More...
 

Properties

bool AlwaysExpanded [get]
 Whether the attribute is always expanded. More...
 
bool ShowNewButton [get]
 Whether to show a "New" button to create new instances. More...
 
string SavePath [get]
 The default path to save newly created ScriptableObjects at. More...
 
bool ShowChildTypes [get]
 Whether to show a dropdown of all types extending the type of the variable. More...
 
IReadOnlyList< Type > RequiredInterfaces [get]
 Interfaces that must be implemented by assigned objects. More...
 
bool OnlyShowMainLine [get, set]
 If true, don't show the child properties even if the property is expanded. You can use this to implement your own inspector logic for the child properties. More...
 

Detailed Description

Attribute that enables editing properties of a referenced object.

Normally, to edit a referenced object, you'd have to change the inspector context. With an ExpandableAttribute, you can just expand the property and edit the referenced object inline. If the type of the reference field is a ScriptableObject, the ExpandableAttribute also allows creating new instances in the inspector.

Constructor & Destructor Documentation

◆ ExpandableAttribute()

Infohazard.Core.ExpandableAttribute.ExpandableAttribute ( bool  alwaysExpanded = false,
string  savePath = null,
bool  showNewButton = true,
bool  showChildTypes = false,
params Type[]  requiredInterfaces 
)

Construct a new ExpandableAttribute.

Parameters
alwaysExpandedWhether the attribute is always expanded.
savePathWhether to show a "New" button to create new instances.
showNewButtonThe default path to save newly created ScriptableObjects at.
showChildTypesWhether to show a dropdown of all types extending the type of the variable.
requiredInterfacesInterfaces that must be implemented by assigned objects.

Property Documentation

◆ AlwaysExpanded

bool Infohazard.Core.ExpandableAttribute.AlwaysExpanded
get

Whether the attribute is always expanded.

If false, will show the expander.

◆ OnlyShowMainLine

bool Infohazard.Core.ExpandableAttribute.OnlyShowMainLine
getset

If true, don't show the child properties even if the property is expanded. You can use this to implement your own inspector logic for the child properties.

◆ RequiredInterfaces

IReadOnlyList<Type> Infohazard.Core.ExpandableAttribute.RequiredInterfaces
get

Interfaces that must be implemented by assigned objects.

◆ SavePath

string Infohazard.Core.ExpandableAttribute.SavePath
get

The default path to save newly created ScriptableObjects at.

If unset, this will use the same path as the containing object if it is an asset.

◆ ShowChildTypes

bool Infohazard.Core.ExpandableAttribute.ShowChildTypes
get

Whether to show a dropdown of all types extending the type of the variable.

◆ ShowNewButton

bool Infohazard.Core.ExpandableAttribute.ShowNewButton
get

Whether to show a "New" button to create new instances.

This only works if the type of the field is a ScriptableObject.


The documentation for this class was generated from the following file: