docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SpriteEditorModuleBase

    Base class the Sprite Editor Window custom module inherits from.

    Inheritance
    object
    SpriteEditorModuleBase
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.U2D.Sprites
    Assembly: Unity.2D.Sprite.Editor.dll
    Syntax
    public abstract class SpriteEditorModuleBase
    Remarks

    Sprite Editor Window functionality can be extended by providing custom module. By inheriting from SpriteEditorModuleBase, user will be able to activate the module's functionality from Sprite Editor Window.

    Properties

    moduleName

    The module name to display in Sprite Editor Window.

    Declaration
    public abstract string moduleName { get; }
    Property Value
    Type Description
    string

    String to represent the name of the module

    spriteEditor

    The ISpriteEditor instance that instantiated the module.

    Declaration
    public ISpriteEditor spriteEditor { get; }
    Property Value
    Type Description
    ISpriteEditor

    An instance of ISpriteEditor

    Methods

    ApplyRevert(bool)

    This is called when user clicks on the Apply or Revert button in Sprite Editor Window.

    Declaration
    public abstract bool ApplyRevert(bool apply)
    Parameters
    Type Name Description
    bool apply

    True when user wants to apply the data, false when user wants to revert.

    Returns
    Type Description
    bool

    Return true to trigger a reimport.

    CanBeActivated()

    Indicates if the module can be activated with the current ISpriteEditor state.

    Declaration
    public abstract bool CanBeActivated()
    Returns
    Type Description
    bool

    Return true if the module can be activated.

    DoMainGUI()

    Implement this to draw on the Sprite Editor Window.

    Declaration
    public abstract void DoMainGUI()
    Remarks

    Called after Sprite Editor Window draws texture preview of the Asset.Use this to draw gizmos for Sprite data.

    DoPostGUI()

    Implement this to draw widgets in Sprite Editor Window.

    Declaration
    public abstract void DoPostGUI()
    Remarks

    This method is called last to allow drawing of widgets.

    DoToolbarGUI(Rect)

    Implement this to create a custom toolbar.

    Declaration
    public abstract void DoToolbarGUI(Rect drawArea)
    Parameters
    Type Name Description
    Rect drawArea

    Area for drawing tool bar.

    OnModuleActivate()

    This is called when the user activates the module.

    Declaration
    public abstract void OnModuleActivate()
    Remarks

    When user switches to the module via Sprite Editor Window, this method will be called for the module to setup.

    OnModuleDeactivate()

    This is called when user switches to another module.

    Declaration
    public abstract void OnModuleDeactivate()
    Remarks

    When user switches to the another module in Sprite Editor Window, this method will be called for the module to clean up.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)