Skip to main content

Extension points

Every extension point a plugin can use, with the type to implement, the call that registers it, where it runs and the permission it needs. Runtime extension points are registered in IPlugin.Configure on builder.Services; editor extension points in IEditorPlugin.ConfigureServices. All registration calls are extension methods on IServiceCollection.

Runtime​

These run in every game built from the plugin: the editor's edit game behind the scene viewport, play mode, the player and exported games.

To addImplementRegisterRunsPermissionPage
A systemISystem, optionally ISystemLifecycleAddSystem<T>(), AddSystem<T>(phase, order), AddSystem(descriptor)Game thread, one instance per scene, in play mode unless [ExecuteIn] says otherwiseruntimeSceneSystems and components
A componenta struct or class, usually with [Component]AddComponent<T>()Scenes, prefabs, the inspector's Add componentnoneSystems and components
A custom component definitionIComponentDefinitionAddSingleton<IComponentDefinition, T>()Wherever the component is saved, loaded or inspectednoneSystems and components
A script typea class deriving from ScriptAddScript<T>()Like the game's own scriptsnoneSystems and components
A scene built in codea class deriving from SceneAddScene<T>("name")Loaded by name through ISceneManagerruntimeSceneScenes and scene listeners
Code that runs when scenes start and stopISceneListenerAddSceneListener<T>()Game thread, one instance per sceneruntimeSceneScenes and scene listeners
State for one sceneany classAddScoped<T>()One instance per scenenoneScenes and scene listeners
Shared state or a serviceany classAddSingleton<T>() and the other Add… callsOne instance per gamenoneServices
A replacement for an engine servicethe service's interfaceAddSingleton<TService, T>(), or Replace for services registered before pluginsInstead of the engine'snoneServices
An asset typeIAssetImporter, usually AssetImporter<T> or AssetImporter<T, TSettings>AddSingleton<IAssetImporter, T>()Background threads, when an asset is loadednoneImporters and value converters
An asset kind for the editoran AssetKindAddAssetKind(kind, ".ext")The Assets panel's icons and filters, inspectorsnoneImporters and value converters
Asset dependenciesIAssetDependencyExtractorAddSingleton<IAssetDependencyExtractor, T>()The editor's asset database, on background threadsnoneImporters and value converters
Saving a field typeValueConverter<T>AddValueConverter<T>()Scenes, prefabs, the inspectornoneImporters and value converters
Saving a family of field typesIValueConverterFactoryAddValueConverterFactory<T>()Scenes, prefabs, the inspectornoneImporters and value converters
A particle moduleIParticleModuleAddParticleModule<T>("type.name", "Display name")Game thread, every simulation step; the particle editor's Add modulenoneParticle modules
Particle collision with world geometryIParticleCollisionProviderAddSingleton<IParticleCollisionProvider, T>() or AddScopedGame thread, for emitters with world collision onnoneParticle modules
UI above the gameIGameOverlayAddSingleton<IGameOverlay, T>()UI thread, once when the game view is shownnoneGame overlays

Editor​

These run only in the editor, from the plugin's editorAssembly, on the UI thread unless noted. The plugin declares the editorUi permission. The editor calls each of them through a guard: one that throws is reported and skipped, and the project keeps working; see Errors in editor code.

To addImplementRegisterPage
A dock panel, or a replacement for a built-in oneIEditorPanelAddEditorPanel<T>(new EditorPanelInfo(id, title, icon, location))Panels
Commands, menu entries, app bar buttons, shortcutsIEditorCommandContributorAddEditorCommands<T>()Commands, menus and the toolbar
A status bar itemStatusBarViewModel.AddItem(id, order) from an editor serviceCommands, menus and the toolbar
A scene viewport toolIViewportToolAddViewportTool<T>()Viewport tools
Gizmos and drag handles for a componentIGizmoProviderAddGizmoProvider<T>()Gizmo providers
An inspector editor for a field typeIPropertyEditorProviderAddPropertyEditor<T>()Inspector property editors
An inspector for a kind of assetIAssetInspectorAddAssetInspector<T>()Asset inspectors, handlers and thumbnails
What double-clicking an asset doesIAssetOpenHandlerAddAssetOpenHandler<T>()Asset inspectors, handlers and thumbnails
Thumbnails for a kind of asset (thread pool)IThumbnailRendererAddThumbnailRenderer<T>()Asset inspectors, handlers and thumbnails
An entry of the Assets panel's Create menuIAssetFactoryAddAssetFactory<T>()Asset inspectors, handlers and thumbnails
An asset kind known only to the editoran AssetKindAddAssetKind(kind, ".ext")Asset inspectors, handlers and thumbnails
Command palette resultsICommandPaletteProviderAddCommandPaletteProvider<T>()Command palette providers
Icons for entities in the viewport and hierarchyIEntityIconProviderAddEntityIconProvider<T>()Entity icons
A check before play mode, or additions to play sessionsIPlaySessionContributorAddSingleton<IPlaySessionContributor, T>()Editor plugins
A check before the project or editor closesICloseGuardAddSingleton<ICloseGuard, T>()Editor plugins
An editor service of your ownany classany Add… callEditor plugins

Plugin infrastructure​

ToUse
Know the plugin's id, version, folder, permissions and assets folderbuilder.Plugin (PluginInfo)
Read and save settingsbuilder.Settings, or [FromKeyedServices("plugin.id")] IPluginSettings in services
Check what loadedthe PluginLoadReport service
Check a permission for a pluginthe IPluginPermissions service
React to plugins loading and unloading in a gamePluginLoaded and PluginUnloaded events on the game's IEventBus
Host plugins in your own toolPluginLoader.Load, or PluginManager to reload them