Runtime Studio

Component Integration

Build runtime inspectors and persistence for your own MonoBehaviour components.

Component Integration

Custom components can expose their own runtime inspector through IRuntimeComponentDrawer. A normal MonoBehaviour does not need to change before it can be supported.

Start with the component

csharp
using UnityEngine;

public sealed class CharacterStats : MonoBehaviour
{
    public float Health = 100f;
    public float Attack = 10f;
    public float Defense = 5f;
}

Create and register a component drawer

The drawer decides how the component appears and behaves in the Runtime Studio Inspector.

csharp
using System;
using Fullscreen.RuntimeStudio.Runtime.UI.ComponentDrawers;
using UnityEngine;

public sealed class CharacterStatsDrawer : IRuntimeComponentDrawer
{
    public Type ComponentType => typeof(CharacterStats);

    public void Draw(ComponentDrawerContext context, Component component)
    {
        var stats = component as CharacterStats;
        if (stats == null)
        {
            return;
        }

        context.DrawFloat("Health", stats.Health, value => stats.Health = value, 0.1f);
        context.DrawFloat("Attack", stats.Attack, value => stats.Attack = value, 0.1f);
        context.DrawFloat("Defense", stats.Defense, value => stats.Defense = value, 0.1f);
    }
}

Register the drawer from an IEditorModule:

csharp
using Fullscreen.RuntimeStudio.Runtime;

public sealed class CharacterStatsModule : IEditorModule
{
    public void Register(EditorModuleBuilder builder)
    {
        builder.AddDefaultComponentDrawer(new CharacterStatsDrawer());
    }
}

The drawer receives a ComponentDrawerContext with the selected component, editor state, refresh action, field inspector, and helpers for bool, int, float, vector, and text fields.

What Runtime Studio handles

Once a drawer is registered, Runtime Studio handles selection refresh, inspector layout, multi-object editing, field value tracking, and undo and redo for those field changes. The component is visible in the runtime inspector and editable while the game is running.

Saving component data

Simple serializable fields are saved automatically. Use an IComponentStateAdapter when automatic reflection is not enough, including when the component needs version-safe save data, only part of its state, ID-based references, or exclusion of runtime-only fields.

Use a RuntimeIntegration when a component needs work after it is restored, placed, duplicated, or rebound. This is where a project should rebuild runtime-only links, prepare placed prefabs, and apply edit isolation.

Keep component drawers focused on editing values. Put gameplay setup and runtime-only behaviour in the integration layer so that edit isolation can mute it safely.