Modifier

Partager via


InspectorFieldsExample Class

Definition

Example of using InspectorFields attributes in a class to create custom inspectors This is on approach for building complex inspectors that need to be customized or the need to overcome lack of polymorphism support They provide a way to create one inspector for multiple classes Example: Create a MonoBehaviour or scriptable object with a custom inspector. The functionality or settings can be changed by assigning a custom script to the object Use InspectorFields to render the custom properties inside the custom script in the inspector When the app launches, copy the properties to the new instance of the script An example of this can be found in Interactables Receivers. Each Receiver is a custom class that renders their properties in the Interactables custom inspector

public ref class InspectorFieldsExample : UnityEngine::MonoBehaviour
[UnityEngine.AddComponentMenu("Scripts/MRTK/Examples/InspectorFieldsExample")]
public class InspectorFieldsExample : UnityEngine.MonoBehaviour
[<UnityEngine.AddComponentMenu("Scripts/MRTK/Examples/InspectorFieldsExample")>]
type InspectorFieldsExample = class
    inherit MonoBehaviour
Public Class InspectorFieldsExample
Inherits MonoBehaviour
Inheritance
UnityEngine.MonoBehaviour
InspectorFieldsExample
Attributes
UnityEngine.AddComponentMenuAttribute

Constructors

InspectorFieldsExample()

Fields

ComponentIndex
ComponentName
ComponentOption
Enabled
Settings

A holder for the InpsectorFields as a list The inspector will update these settings while in the editor

Applies to