• Manual
  • Scripting API
Show / Hide Table of Contents
  • Introduction
  • How To Install
  • Runtime Objects
    • Creating Runtime Objects
    • Runtime Object Properties
  • Events
    • Event Objects
    • Event Listeners
    • Hello World Example
  • Runtime Items
    • Value Items
    • Reference Items
  • Runtime Lists
    • Value Lists
    • Reference Lists
  • Populators
  • State Machines
    • Using State Machines
    • State Machine Controllers
    • Using State Machine Controllers
  • Versioning Your Apps
  • Modular Scene Loading
  • Attributes
  • License
  • Advanced Topics
    • Settings
    • Why The Resources Folder?
    • Strings as Value Types?
    • Extending The Framework

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:

Figure1

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.

  • Improve this Doc
Back to top Generated by DocFX