Repository navigation
en architecture editor extensions
中文 | English | Docs | Repository
The editor is not closed: a project can ship editor scripts under its own Assets directory to register custom Inspectors, tool windows, and menu items. This page covers the boundaries and entry points.
| Source location | Output | Loaded by |
|---|---|---|
Assets/**/Editor/**/*.cs |
GameScriptsEditor.dll |
Editor process only |
Assets/**/*.cs (everything else) |
GameScripts.dll |
Editor and player builds |
Managed/Nullus.Editor |
Editor scripting API | Editor |
Editor scripts may reference Nullus.Editor; runtime project code may not.
| Extension point | Base type or attribute |
|---|---|
| Custom Inspector |
ComponentEditor with [CustomEditor] and [CanEditMultipleObjects]
|
| Custom tool window |
EditorWindow with [EditorMenuItem]
|
| Menu item |
[EditorMenuItem], top level restricted to Window or Tools
|
Menu items end up next to the built-in panels in the editor's top-level menus.
All reflected detail panels must use Inspector::InspectorPropertyEditor. It owns the single implementation of typed property controls, layouts, registered drawers, mixed/read-only values, references and collections. InspectorView provides selection and prefab actions; ReflectedPropertyEditor adapts document values to a staged SerializedObject without constructing an Inspector panel.
Use ReflectedPropertyEditor::Draw/DrawValues for document values, PropertyEditorContext for an existing serialized stream, and ApplyReflectedEdit for the document's preview/commit/cancel boundary. Pass ranges, drag steps, color semantics and custom drawer keys as metadata. Compact VFX rows use PropertyEditorLayout::ValueOnly inside their own table; numeric, vector, color and enum widgets must not be reimplemented in each panel. Domain layouts, graph canvases and binding selectors can surround the shared controls. SharedPropertyEditor tests enforce the common route.
Scripts never write component objects directly. Reads and writes go through:
serializedObject -> SerializedProperty -> ApplyModifiedProperties()
That path is what makes script editors share the following with built-in editors:
- The undo stack
- Prefab override recording
- Multi-object editing semantics
- Field type conversion and validation
Bypassing it breaks undo and Prefab semantics and is not a supported usage.
| Target | How to declare it |
|---|---|
| Reflected engine component | Use the generated type carrying NativeTypeName
|
| Project script component | Use a Nullus.Behaviour subclass |
Script components share one native reflected type, so matching is by the script's own full C# name. One script's editor never affects another, and base-class matching for subclasses is not supported.
- A script editor defaults to a higher priority than the built-in editor, which is how it can override one.
- A duplicate combination of target type, inheritance rule, and priority fails registration with an explicit error rather than being silently deduplicated.
Exceptions thrown by a script or editor are caught:
- That Inspector falls back to generic drawing and shows the error.
- After enough consecutive failures the script editor is disabled.
- Other panels are unaffected.
- Recompiling scripts rescans the registry and rebuilds open editors and windows.
EditorGUILayout provides Label, Space, Toggle, IntField, FloatField, Slider, TextField, Button, HelpBox, and PropertyField, plus BeginHorizontal / EndHorizontal and BeginVertical / EndVertical.
- Script
CustomPropertyDrawerregistration is not exposed. - There is no arbitrary ImGui passthrough.
- Extension points are limited to Inspectors, tool windows, and menu items.
- Built-in icons are generated from
Tools/Icons/icons.manifest.json;editor.icon.*ids stay stable after release, and script extensions reference built-in ids directly. - Native modules can register module icons at startup through
IconRegistry::Registerand callUnregisterModuleon unload. Ids must followeditor.icon.<domain>.<name>; never use file paths or transient textures as icon ids. - Script extensions do not expose icon registration yet. Add new icons to the manifest on the native side first, then reference them from scripts.
Built-in panels (Hierarchy, Inspector, Asset Browser, Console, Profiler, Project Settings, and others) are implemented in the C++ editor and register through the same panel and command system. Script extensions are peers of built-in panels for menus and panel management, but scripts only receive the controlled API.
Panels open and close on demand. The quickest way to check whether a panel registered is to open the Window menu and look for it.
- Start with a minimal Inspector under
Assets/**/Editor/to verify the registration path. - Access fields through
serializedObject; never cache component objects. - For multi-object editing use
[CanEditMultipleObjects]and avoid assuming a single target. - When you need a new control type, extend the controlled API first and then update this page.
- UI Designer and Editor Extensions has the full sample code.
- Module Structure shows where assemblies and tools live.
Nullus Engine
中文
- 认识 Nullus
- 安装与快速入门
- 使用编辑器
- 场景与对象
- Prefab 工作流
- 资产与内容管线
- 渲染、材质与光照
- 大场景与资源管理
- 游戏逻辑与脚本
- 用户界面
- 动画与角色
- 物理与交互
- 音频、特效与媒体
- AI 与联网
- 平台、构建与发布
- 扩展与引擎架构
- 调试、性能与质量
- 参考手册
- 示例与发展路线
English
- Getting to Know Nullus
- Install and Quick Start
- Using the Editor
- Scenes and Objects
- Prefab Workflow
- Assets and Content Pipeline
- Rendering, Materials, and Lighting
- Large Scenes and Resource Management
- Gameplay and Scripting
- User Interface
- Animation and Characters
- Physics and Interaction
- Audio, Visual Effects, and Media
- AI and Networking
- Platforms, Builds, and Releases
- Extending the Engine
- Debugging, Performance, and Quality
- Reference
- Examples and Roadmap