// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. using System; using FlaxEngine; namespace FlaxEditor { /// /// Base class for all plugins used in Editor. /// /// /// Plugins should have a public and parameter-less constructor. /// /// public abstract class EditorPlugin : Plugin { /// /// Gets the type of the that is related to this plugin. Some plugins may be used only in editor while others want to gave a runtime representation. Use this property to link the related game plugin. /// public virtual Type GamePluginType => null; /// /// Gets the editor instance. Use it to extend the editor. /// public Editor Editor { get; private set; } /// public override void Initialize() { base.Initialize(); Editor = Editor.Instance; if (Editor.IsInitialized) { InitializeEditor(); } else { Editor.InitializationEnd += OnEditorInitializationEnd; } } private void OnEditorInitializationEnd() { Editor.InitializationEnd -= OnEditorInitializationEnd; InitializeEditor(); } /// /// Initialization method called when this plugin is loaded and the Editor is after initialization. Use this method to add custom editor functionalities or override the existing ones. /// public virtual void InitializeEditor() { } } }