Attributes
Scriptable Framework also comes with a couple of attributes that can help you get more out of your inspector by easily extending it for your script:
The image above shows an example of what your inspector can look like when using these attributes.
The first is the SearchableEnumAttribute
which, when added to an exposed enum variable, will alter how the options for the enum get rendered and even add a scroll bar and search field to help you find your desired value!
The second attribute is the FoldoutAttribute
which can be used similarly to Unity's HeaderAttribute
(which you can learn more about here). What makes this different to headers is that it can wrap one or many variables into a collapsable fold out. This is great for inspectors that grow to have several exposed variables and end up forcing you to scoll down to the variable you wish to access.
Here is an example of how to use them:
using UnityEngine;
using ScriptableFramework;
public class AttributeDemo : MonoBehaviour
{
public KeyCode keyInput;
[SearchableEnum]
public KeyCode searchableKeyInput;
[Foldout ("String variables", true)]
public string text1;
public string text2;
[Foldout ("Foldout for one")]
public string text3;
}
Credit to Dimitry and Ryan Hipple as the original authors of these attributes.