Editor Extensions Docs

Overview

Editor Extensions are additional functionality that can be used optionally with the Runtime Editor. At the moment there are three built-in editor extensions:

  1. Runtime Builder - integration and user interface for Unity ProBuilder.
  2. Terrain Editor - user interface and additional functionality for Terrain editing
  3. Runtime Scripting - ability to create and compile MonoBehavior scripts at runtime

Screenshot

Getting Started

To start working with the editor extensions perform the following steps:

  1. Create Runtime Editor using Tools->Runtime Editor->Create Editor.
  2. Create Editor Extensions using Tools->Runtime Editor->Create Extensions. Screenshot  
  3. Hit Play.
  4. Editor extensions should be available from the Window menu item. Screenshot  

Editor Extensions

Editor extensions are located in Assets/Battlehub/RTExtensions folder. The /Content folder contains resources and prefabs, the /Runtime folder contains runtime scripts, and the /Editor folder contains scripts that run in the Unity editor. The prefab that initializes all extensions is called EditorExtensions and is located in the /RTExtensions/Content/Runtime folder.

Screenshot

Runtime Builder

The Runtime Builder extension allows you to create and edit meshes, prototype, edit game object materials and texture UVs in Runtime Editor using Unity ProBuilder.

RTBuilder prefab can be found in Assets\Battlehub\RTExtensions\Content\Runtime\RTBuilder.

Standalone RTBuilder demo scene can be found in: Assets\Battlehub\RTEditorDemo\Content\Runtime\RTExtensions\RTBuilder

Screenshot

Terrain Editor

The Terrain Editor extension allows you to add to Runtime Editor the possibility of editing Terrain objects.

RTTerrain prefab can be found in __Assets\Battlehub\RTExtensions\Content\Runtime\RTTerrain folder.

Screenshot

Runtime Scripting

The Runtime Scripting extension allows you to create C# scripts at run-time using the Runtime Editor. The RTScripting prefab that initializes the extension can be found at Assets\Battlehub\
RTScripting\Content\Runtime
.

Note

Runtime Scripting Extension is only supported in a Standalone Windows build

Note

Runtime Scripting Extension use Roslyn.net compiler platform

After adding the RTScripting prefab to the scene, the Create->Script context menu item becomes available. Screenshot

The script editor can be opened using the context menu or by double-clicking the script icon. Screenshot

For programmatic access to the RTScripting extension you need to use the IRuntimeScriptManager interface. Here is how to add references to additional assemblies:

using Battlehub.RTCommon;
using Battlehub.RTEditor;
using Battlehub.RTScripting;
using UnityEngine.AI;

public class AddReferencesExample : EditorExtension
{
    protected override void OnEditorExist()
    {
        base.OnEditorExist();

        IRuntimeScriptManager scriptManager = IOC.Resolve<IRuntimeScriptManager>();
        scriptManager.AddReference(typeof(NavMesh).Assembly.Location);
    }
}