Experimental: this API is experimental and might be changed or removed in the future.

SpriteEditorModuleBase

class in UnityEditor.Experimental.U2D

매뉴얼로 전환

설명

Base class the Sprite Editor Window custom module inherits from.

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.

using UnityEditor.Experimental.U2D;
using UnityEngine;

public class MySpriteEditorCustomModule : SpriteEditorModuleBase { // The name of the module that will be shown in Sprite Editor Window drop down menu public override string moduleName { get { return "MySpriteEditorCustomModule"; } }

// This is called when user clicks on the Apply or Revert button in Sprite Editor Window public override bool ApplyRevert(bool apply) { return true; }

// Indicates if the module can be activated with the current ISpriteEditor state public override bool CanBeActivated() { return true; }

// Called after SpriteEditorWindow drawn the sprite. // UnityEditor.Handles draw calls will operate in Texture space public override void DoMainGUI() {}

// Draw user tool bar public override void DoToolbarGUI(Rect drawArea) {}

// Called when the module is activated by user public override void OnModuleActivate() {}

// Called when user switches to another module public override void OnModuleDeactivate() {}

// Any last GUI draw. This is in the SpriteEditorWindow's space. // Any GUI draw will appear on top public override void DoPostGUI() {} }

변수

moduleNameThe module name to display in Sprite Editor Window.
spriteEditorThe ISpriteEditor instance that instantiated the module.

Public 함수

ApplyRevertThis is called when user clicks on the Apply or Revert button in Sprite Editor Window.
CanBeActivatedIndicates if the module can be activated with the current ISpriteEditor state.
DoMainGUIImplement this to draw on the Sprite Editor Window.
DoPostGUIImplement this to draw widgets in Sprite Editor Window.
DoToolbarGUIImplement this to create a custom toolbar.
OnModuleActivateThis is called when the user activates the module.
OnModuleDeactivateThis is called when user switches to another module.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961