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:
- Runtime Builder - integration and user interface for Unity ProBuilder.
- Terrain Editor - user interface and additional functionality for Terrain editing
- Runtime Scripting - ability to create and compile MonoBehavior scripts at runtime
Getting Started
To start working with the editor extensions perform the following steps:
- Create Runtime Editor using Tools->Runtime Editor->Create Editor.
- Create Editor Extensions using Tools->Runtime Editor->Create Extensions.
- Hit Play.
- Editor extensions should be available from the Window menu item.
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.
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
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.
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.
The script editor can be opened using the context menu or by double-clicking the script icon.
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);
}
}