A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
refactor: introduce SystemLabel constants and runIf condition for system scheduling
esengine85e930f14ee6
diff --git a/sdk/src/animation/AnimationPlugin.ts b/sdk/src/animation/AnimationPlugin.tsindex 0bda7b62d..67fcc72f2 100644--- a/sdk/src/animation/AnimationPlugin.ts+++ b/sdk/src/animation/AnimationPlugin.ts@@ -10,7 +10,8 @@ import { Time, type TimeData } from '../resource';import type { ESEngineModule, CppRegistry } from '../wasm';import { initTweenAPI, shutdownTweenAPI, Tween } from './Tween';import { spriteAnimatorSystemUpdate } from './SpriteAnimator';-import { isEditor, isPlayMode } from '../env';+import { playModeOnly } from '../env';+import { SystemLabel } from '../systemLabels';export class AnimationPlugin implements Plugin {name = 'animation';@@ -24,20 +25,18 @@ export class AnimationPlugin implements Plugin {app.addSystemToSchedule(Schedule.Update, defineSystem([Res(Time)],(time: TimeData) => {- if (isEditor() && !isPlayMode()) return;Tween.update(time.delta);},{ name: 'TweenSystem' }- ));+ ), { runIf: playModeOnly });app.addSystemToSchedule(Schedule.Update, defineSystem([Res(Time)],(time: TimeData) => {- if (isEditor() && !isPlayMode()) return;spriteAnimatorSystemUpdate(world, time.delta);},{ name: 'SpriteAnimatorSystem' }- ), { runAfter: ['TweenSystem'] });+ ), { runAfter: [SystemLabel.Tween], runIf: playModeOnly });}cleanup(): void {diff --git a/sdk/src/app.ts b/sdk/src/app.tsindex de59c735b..1960cd3b3 100644--- a/sdk/src/app.ts+++ b/sdk/src/app.ts@@ -42,10 +42,13 @@ export interface Plugin {// System Entry// =============================================================================+export type RunCondition = () => boolean;+interface SystemEntry {system: SystemDef;runBefore?: string[];runAfter?: string[];+ runIf?: RunCondition;}// =============================================================================@@ -156,12 +159,13 @@ export class App {addSystemToSchedule(schedule: Schedule,system: SystemDef,- options?: { runBefore?: string[]; runAfter?: string[] }+ options?: { runBefore?: string[]; runAfter?: string[]; runIf?: RunCondition }): this {this.systems_.get(schedule)!.push({system,runBefore: options?.runBefore,runAfter: options?.runAfter,+ runIf: options?.runIf,});this.sortedSystemsCache_.delete(schedule);return this;@@ -643,6 +647,7 @@ export class App {const t0 = this.phaseTimings_ ? performance.now() : 0;for (const entry of systems) {+ if (entry.runIf && !entry.runIf()) continue;try {const result = this.runner_.run(entry.system);if (result instanceof Promise) {diff --git a/sdk/src/core.ts b/sdk/src/core.tsindex ccf5fa5e9..a0dab9b8d 100644--- a/sdk/src/core.ts+++ b/sdk/src/core.ts@@ -694,8 +694,11 @@ export {isRuntime,setPlayMode,isPlayMode,+ playModeOnly,} from './env';+export type { RunCondition } from './app';+// =============================================================================// Physics// =============================================================================diff --git a/sdk/src/env.ts b/sdk/src/env.tsindex 27a494791..ace5b727d 100644--- a/sdk/src/env.ts+++ b/sdk/src/env.ts@@ -20,3 +20,7 @@ export function setPlayMode(active: boolean): void {export function isPlayMode(): boolean {return playMode;}++export function playModeOnly(): boolean {+ return !editorMode || playMode;+}diff --git a/sdk/src/physics/PhysicsPlugin.ts b/sdk/src/physics/PhysicsPlugin.tsindex b0e26679e..dc04bcee4 100644--- a/sdk/src/physics/PhysicsPlugin.ts+++ b/sdk/src/physics/PhysicsPlugin.ts@@ -9,7 +9,7 @@ import type { TransformData, ParentData, CanvasData } from '../component';import { Transform, Parent, Canvas } from '../component';import { defineResource, Res, Time, type TimeData } from '../resource';import { Schedule, defineSystem } from '../system';-import { isEditor, isPlayMode } from '../env';+import { playModeOnly } from '../env';import {loadPhysicsModule,type PhysicsWasmModule,@@ -189,8 +189,6 @@ export class PhysicsPlugin implements Plugin {defineSystem([Res(Time)],(time: TimeData) => {- if (isEditor() && !isPlayMode()) return;-const entities = world.getEntitiesWithComponents([RigidBody, Transform]);const currentEntities = new Set<Entity>();@@ -285,7 +283,8 @@ export class PhysicsPlugin implements Plugin {collectEvents(app, module, ppu);},{ name: 'PhysicsSystem' }- )+ ),+ { runIf: playModeOnly });app.physicsModule = module;diff --git a/sdk/src/systemLabels.ts b/sdk/src/systemLabels.tsnew file mode 100644index 000000000..9ed5b23bc--- /dev/null+++ b/sdk/src/systemLabels.ts@@ -0,0 +1,19 @@+/**+ * @file systemLabels.ts+ * @brief System name constants for ordering dependencies+ */++export const SystemLabel = {+ UILayout: 'UILayoutSystem',+ UILayoutLate: 'UILayoutLateSystem',+ UIRenderOrder: 'UIRenderOrderSystem',+ UIInteraction: 'UIInteractionSystem',+ Button: 'ButtonSystem',+ ScrollView: 'ScrollViewSystem',+ CollectionView: 'CollectionViewSystem',+ ListView: 'ListViewSystem',+ Text: 'TextSystem',+ Image: 'ImageSystem',+ Focus: 'FocusSystem',+ Tween: 'TweenSystem',+} as const;diff --git a/sdk/src/timeline/TimelinePlugin.ts b/sdk/src/timeline/TimelinePlugin.tsindex b236db81b..8b9c28fe0 100644--- a/sdk/src/timeline/TimelinePlugin.ts+++ b/sdk/src/timeline/TimelinePlugin.ts@@ -3,7 +3,7 @@ import { defineSystem, Schedule } from '../system';import { Res } from '../resource';import { Time, type TimeData } from '../resource';import { defineComponent, getComponent } from '../component';-import { isEditor, isPlayMode } from '../env';+import { playModeOnly } from '../env';import { WrapMode, TrackType, type TimelineAsset, type AnimFramesTrack } from './TimelineTypes';import { parseTimelineAsset } from './TimelineLoader';import { uploadTimelineToWasm, type UploadResult } from './TimelineUploader';@@ -76,8 +76,6 @@ export class TimelinePlugin implements Plugin {app.addSystemToSchedule(Schedule.Update, defineSystem([Res(Time)],(time: TimeData) => {- if (isEditor() && !isPlayMode()) return;-const module = world.getWasmModule() as ESEngineModule;if (!module) return;@@ -137,7 +135,7 @@ export class TimelinePlugin implements Plugin {}},{ name: 'TimelineSystem' },- ));+ ), { runIf: playModeOnly });}clearHandles(): void {diff --git a/sdk/src/ui/CollectionViewPlugin.ts b/sdk/src/ui/CollectionViewPlugin.tsindex 754d34e2e..3b149c3cc 100644--- a/sdk/src/ui/CollectionViewPlugin.ts+++ b/sdk/src/ui/CollectionViewPlugin.ts@@ -15,6 +15,7 @@ import { ItemPool } from './ItemPool';import { UIRect, type UIRectData } from './UIRect';import { getEffectiveWidth, getEffectiveHeight } from './uiHelpers';import { Image as UIImage } from './Image';+import { SystemLabel } from '../systemLabels';export interface CollectionState {pool: ItemPool;@@ -164,7 +165,7 @@ export class CollectionViewPlugin implements Plugin {}},{ name: 'CollectionViewSystem' },- ), { runAfter: ['UILayoutLateSystem'], runBefore: ['UIRenderOrderSystem'] });+ ), { runAfter: [SystemLabel.UILayoutLate], runBefore: [SystemLabel.UIRenderOrder] });this.cleanup_ = () => {for (const [, st] of states) {diff --git a/sdk/src/ui/DataBindingPlugin.ts b/sdk/src/ui/DataBindingPlugin.tsindex af4a66b47..c5f28e8b6 100644--- a/sdk/src/ui/DataBindingPlugin.ts+++ b/sdk/src/ui/DataBindingPlugin.ts@@ -3,9 +3,10 @@ import type { Entity } from '../types';import type { AnyComponentDef } from '../component';import { defineSystem, Schedule } from '../system';import { registerComponent, getComponent } from '../component';-import { isEditor, isPlayMode } from '../env';+import { playModeOnly } from '../env';import { DataBinding, type DataBindingData, type BindingEntry } from './DataBinding';import { compileExpression } from './DataBindingExpression';+import { SystemLabel } from '../systemLabels';const componentDefCache = new Map<string, AnyComponentDef | null>();@@ -28,8 +29,6 @@ export class DataBindingPlugin implements Plugin {app.addSystemToSchedule(Schedule.PreUpdate, defineSystem([],() => {- if (isEditor() && !isPlayMode()) return;-for (const entity of lastSourceTick.keys()) {if (!world.valid(entity) || !world.has(entity, DataBinding)) {lastSourceTick.delete(entity);@@ -56,7 +55,7 @@ export class DataBindingPlugin implements Plugin {}},{ name: 'DataBindingSystem' }- ), { runBefore: ['TextSystem', 'ImageSystem'] });+ ), { runBefore: [SystemLabel.Text, SystemLabel.Image], runIf: playModeOnly });}}diff --git a/sdk/src/ui/DragPlugin.ts b/sdk/src/ui/DragPlugin.tsindex 76cc8511c..d8f6a76c6 100644--- a/sdk/src/ui/DragPlugin.ts+++ b/sdk/src/ui/DragPlugin.ts@@ -16,8 +16,9 @@ import type { UIInteractionData } from './UIInteraction';import { UIEvents, UIEventQueue } from './UIEvents';import { UICameraInfo } from './UICameraInfo';import type { UICameraData } from './UICameraInfo';-import { isEditor, isPlayMode } from '../env';+import { playModeOnly } from '../env';import { getEntityDepth } from './uiHelpers';+import { SystemLabel } from '../systemLabels';import { quaternionToAngle2D } from './uiMath';function worldToLocalDelta(@@ -87,7 +88,6 @@ export class DragPlugin implements Plugin {app.addSystemToSchedule(Schedule.PreUpdate, defineSystem([Res(Input), Res(UICameraInfo)],(input: InputState, camera: UICameraData) => {- if (isEditor() && !isPlayMode()) return;if (!camera.valid) return;const worldMouse = { x: camera.worldMouseX, y: camera.worldMouseY };@@ -220,8 +220,8 @@ export class DragPlugin implements Plugin {}}},- { name: 'DragSystem', runAfter: ['UIInteractionSystem'] }- ));+ { name: 'DragSystem', runAfter: [SystemLabel.UIInteraction] }+ ), { runIf: playModeOnly });}}diff --git a/sdk/src/ui/DropdownPlugin.ts b/sdk/src/ui/DropdownPlugin.tsindex 39bcb1966..46dcefd97 100644--- a/sdk/src/ui/DropdownPlugin.ts+++ b/sdk/src/ui/DropdownPlugin.ts@@ -22,6 +22,7 @@ import type { InputState } from '../input';import { isEditor, isPlayMode } from '../env';import { ensureComponent, getEffectiveWidth, getEffectiveHeight, setEntityColor, setEntityEnabled, withChildEntity } from './uiHelpers';import { DROPDOWN_ITEM_HEIGHT, DROPDOWN_FONT_SIZE, DROPDOWN_HIGHLIGHT_COLOR, DROPDOWN_DEFAULT_COLOR, DROPDOWN_OPTION_COLOR } from './uiConstants';+import { SystemLabel } from '../systemLabels';interface DropdownState {optionEntities: Entity[];@@ -153,7 +154,7 @@ export class DropdownPlugin implements Plugin {}},{ name: 'DropdownSystem' }- ), { runAfter: ['UIInteractionSystem'] });+ ), { runAfter: [SystemLabel.UIInteraction] });function normalizeListTransform(listEntity: Entity): void {withChildEntity(world, listEntity, (e) => {diff --git a/sdk/src/ui/FocusPlugin.ts b/sdk/src/ui/FocusPlugin.tsindex 681e77bc8..42aa8bcf4 100644--- a/sdk/src/ui/FocusPlugin.ts+++ b/sdk/src/ui/FocusPlugin.ts@@ -11,7 +11,7 @@ import { Interactable } from './Interactable';import type { InteractableData } from './Interactable';import { UIInteraction } from './UIInteraction';import type { UIInteractionData } from './UIInteraction';-import { isEditor, isPlayMode } from '../env';+import { playModeOnly } from '../env';import { UIEvents, UIEventQueue } from './UIEvents';export class FocusPlugin implements Plugin {@@ -27,7 +27,6 @@ export class FocusPlugin implements Plugin {app.addSystemToSchedule(Schedule.Update, defineSystem([Res(Input), Res(UIEvents)],(input: InputState, events: UIEventQueue) => {- if (isEditor() && !isPlayMode()) return;if (focusManager.focusedEntity !== null && !world.valid(focusManager.focusedEntity)) {focusManager.focusedEntity = null;}@@ -95,7 +94,7 @@ export class FocusPlugin implements Plugin {}},{ name: 'FocusSystem' }- ));+ ), { runIf: playModeOnly });}}diff --git a/sdk/src/ui/ImagePlugin.ts b/sdk/src/ui/ImagePlugin.tsindex 6fba95aa7..91effa244 100644--- a/sdk/src/ui/ImagePlugin.ts+++ b/sdk/src/ui/ImagePlugin.ts@@ -9,6 +9,7 @@ import type { UIRectData } from './UIRect';import { UIRenderer, UIVisualType } from './UIRenderer';import type { UIRendererData } from './UIRenderer';import { getEffectiveWidth, getEffectiveHeight } from './uiHelpers';+import { SystemLabel } from '../systemLabels';function ensureUIRenderer(world: import('../world').World, entity: Entity): void {if (!world.has(entity, UIRenderer)) {@@ -120,7 +121,7 @@ export class ImagePlugin implements Plugin {}},{ name: 'ImageSystem' }- ), { runAfter: ['UILayoutSystem'] });+ ), { runAfter: [SystemLabel.UILayout] });}}diff --git a/sdk/src/ui/ProgressBarPlugin.ts b/sdk/src/ui/ProgressBarPlugin.tsindex 9bc6d9692..ae74a17bb 100644--- a/sdk/src/ui/ProgressBarPlugin.ts+++ b/sdk/src/ui/ProgressBarPlugin.ts@@ -6,6 +6,7 @@ import type { UIRectData } from './UIRect';import { ProgressBar } from './ProgressBar';import type { ProgressBarData } from './ProgressBar';import { applyDirectionalFill, withChildEntity } from './uiHelpers';+import { SystemLabel } from '../systemLabels';export class ProgressBarPlugin implements Plugin {name = 'progressBar';@@ -29,7 +30,7 @@ export class ProgressBarPlugin implements Plugin {}},{ name: 'ProgressBarSystem' }- ), { runAfter: ['UILayoutSystem'] });+ ), { runAfter: [SystemLabel.UILayout] });}}diff --git a/sdk/src/ui/SafeAreaPlugin.ts b/sdk/src/ui/SafeAreaPlugin.tsindex 08051b7c0..d31562db9 100644--- a/sdk/src/ui/SafeAreaPlugin.ts+++ b/sdk/src/ui/SafeAreaPlugin.ts@@ -9,6 +9,7 @@ import { UICameraInfo } from './UICameraInfo';import type { UICameraData } from './UICameraInfo';import { UIRect } from './UIRect';import type { UIRectData } from './UIRect';+import { SystemLabel } from '../systemLabels';export interface SafeAreaInsets {top: number;@@ -128,7 +129,7 @@ export class SafeAreaPlugin implements Plugin {}},{ name: 'SafeAreaSystem' }- ), { runBefore: ['UILayoutSystem'] });+ ), { runBefore: [SystemLabel.UILayout] });}}diff --git a/sdk/src/ui/ScrollViewPlugin.ts b/sdk/src/ui/ScrollViewPlugin.tsindex 8be9284f9..6a0c4fecb 100644--- a/sdk/src/ui/ScrollViewPlugin.ts+++ b/sdk/src/ui/ScrollViewPlugin.ts@@ -26,6 +26,7 @@ import {SCROLL_MAX_OVERSCROLL_RATIO, SCROLL_MAX_VELOCITY_RATIO,SCROLL_POSITION_EPSILON,} from './uiConstants';+import { SystemLabel } from '../systemLabels';function rubberBand(pos: number, min: number, max: number, viewSize: number): number {if (viewSize <= 0) return 1;@@ -308,7 +309,7 @@ export class ScrollViewPlugin implements Plugin {}},{ name: 'ScrollViewSystem' }- ), { runAfter: ['UILayoutLateSystem'], runBefore: ['UIRenderOrderSystem'] });+ ), { runAfter: [SystemLabel.UILayoutLate], runBefore: [SystemLabel.UIRenderOrder] });this.cleanup_ = () => {states.clear();diff --git a/sdk/src/ui/SelectablePlugin.ts b/sdk/src/ui/SelectablePlugin.tsindex 2e4e5babb..d1a057158 100644--- a/sdk/src/ui/SelectablePlugin.ts+++ b/sdk/src/ui/SelectablePlugin.ts@@ -2,7 +2,7 @@ import type { App, Plugin } from '../app';import { defineSystem, Schedule } from '../system';import { Res } from '../resource';import type { Entity } from '../types';-import { isPlayMode } from '../env';+import { playModeOnly } from '../env';import { Interactable } from './Interactable';import { UIInteraction, type UIInteractionData } from './UIInteraction';import { Selectable, type SelectableData } from './Selectable';@@ -17,8 +17,6 @@ export class SelectablePlugin implements Plugin {app.addSystemToSchedule(Schedule.Update, defineSystem([Res(UIEvents)],(uiEvents: UIEventQueue) => {- if (!isPlayMode()) return;-const entities = world.getEntitiesWithComponents([Selectable, Interactable]);for (const entity of entities) {@@ -50,7 +48,7 @@ export class SelectablePlugin implements Plugin {}},{ name: 'SelectableSystem' },- ));+ ), { runIf: playModeOnly });}}diff --git a/sdk/src/ui/SliderPlugin.ts b/sdk/src/ui/SliderPlugin.tsindex 463d5df8e..262ba2faa 100644--- a/sdk/src/ui/SliderPlugin.ts+++ b/sdk/src/ui/SliderPlugin.ts@@ -19,6 +19,7 @@ import { UIEvents, UIEventQueue } from './UIEvents';import { isEditor, isPlayMode } from '../env';import { applyDirectionalFill, getEffectiveWidth, getEffectiveHeight, ensureComponent, withChildEntity } from './uiHelpers';import { quaternionToAngle2D } from './uiMath';+import { SystemLabel } from '../systemLabels';function computeSliderValue(worldMouseX: number, worldMouseY: number,@@ -155,7 +156,7 @@ export class SliderPlugin implements Plugin {}},{ name: 'SliderSystem' }- ), { runAfter: ['UIInteractionSystem'] });+ ), { runAfter: [SystemLabel.UIInteraction] });}}diff --git a/sdk/src/ui/StateMachinePlugin.ts b/sdk/src/ui/StateMachinePlugin.tsindex 0a21d5d88..2619247f0 100644--- a/sdk/src/ui/StateMachinePlugin.ts+++ b/sdk/src/ui/StateMachinePlugin.ts@@ -31,6 +31,7 @@ import type { ESEngineModule } from '../wasm';import { Assets, type AssetsData } from '../asset/AssetPlugin';import type { AssetServer } from '../asset/AssetServer';import { EntityStateMap } from './uiHelpers';+import { SystemLabel } from '../systemLabels';import {isAssetPropertyPath, normalizeAssetValue, collectAssetPaths,StateMachineAssetCache,@@ -587,7 +588,7 @@ export class StateMachinePlugin implements Plugin {}},{ name: 'StateMachineSystem' }- ), { runAfter: ['ButtonSystem'] });+ ), { runAfter: [SystemLabel.Button] });}}diff --git a/sdk/src/ui/TextInputPlugin.ts b/sdk/src/ui/TextInputPlugin.tsindex 1215c014d..a981ffafb 100644--- a/sdk/src/ui/TextInputPlugin.ts+++ b/sdk/src/ui/TextInputPlugin.ts@@ -14,9 +14,10 @@ import { UIEvents, UIEventQueue } from './UIEvents';import { Res } from '../resource';import { platformCreateCanvas } from '../platform';import { requireResourceManager } from '../resourceManager';-import { isEditor, isPlayMode } from '../env';+import { playModeOnly } from '../env';import { wrapText, nextPowerOf2, ensureComponent, colorToRgba } from './uiHelpers';import { CURSOR_BLINK_INTERVAL, TEXT_INPUT_LINE_HEIGHT_RATIO } from './uiConstants';+import { SystemLabel } from '../systemLabels';export class TextInputPlugin implements Plugin {name = 'textInput';@@ -33,7 +34,7 @@ export class TextInputPlugin implements Plugin {build(app: App): void {registerComponent('TextInput', TextInput);- if (isEditor() && !isPlayMode()) return;+ if (!playModeOnly()) return;const moduleOrNull = app.wasmModule;if (!moduleOrNull) {@@ -244,7 +245,7 @@ export class TextInputPlugin implements Plugin {}},{ name: 'TextInputFocusSystem' }- ), { runAfter: ['FocusSystem'] });+ ), { runAfter: [SystemLabel.Focus] });// Render systemapp.addSystemToSchedule(Schedule.PreUpdate, defineSystem(diff --git a/sdk/src/ui/TextPlugin.ts b/sdk/src/ui/TextPlugin.tsindex 3b27778a4..a2d526786 100644--- a/sdk/src/ui/TextPlugin.ts+++ b/sdk/src/ui/TextPlugin.ts@@ -10,6 +10,7 @@ import type { UIRendererData } from './UIRenderer';import { getEffectiveWidth, getEffectiveHeight, setUIRectSizeNative } from './uiHelpers';import { getImageResolver, type DefaultImageResolver } from './ImageResolver';import { parseRichText } from './RichTextParser';+import { SystemLabel } from '../systemLabels';function ensureUIRenderer(world: import('../world').World, entity: Entity): void {if (!world.has(entity, UIRenderer)) {@@ -141,7 +142,7 @@ export class TextPlugin implements Plugin {}},{ name: 'TextSystem' }- ), { runAfter: ['UILayoutSystem'] });+ ), { runAfter: [SystemLabel.UILayout] });}}diff --git a/sdk/src/ui/TogglePlugin.ts b/sdk/src/ui/TogglePlugin.tsindex f05c76ecf..cc8e8f043 100644--- a/sdk/src/ui/TogglePlugin.ts+++ b/sdk/src/ui/TogglePlugin.ts@@ -16,6 +16,7 @@ import { UIRenderer } from './UIRenderer';import type { UIRendererData } from './UIRenderer';import { isEditor, isPlayMode } from '../env';import { applyColorTransition, applyDefaultTint, ensureComponent, withChildEntity } from './uiHelpers';+import { SystemLabel } from '../systemLabels';function setRendererColor(world: import('../world').World, entity: Entity, color: Color): void {if (!world.has(entity, UIRenderer)) return;@@ -138,7 +139,7 @@ export class TogglePlugin implements Plugin {}},{ name: 'ToggleSystem' }- ), { runAfter: ['UIInteractionSystem'] });+ ), { runAfter: [SystemLabel.UIInteraction] });}}diff --git a/sdk/src/ui/UIInteractionPlugin.ts b/sdk/src/ui/UIInteractionPlugin.tsindex 6114da813..a732dded8 100644--- a/sdk/src/ui/UIInteractionPlugin.ts+++ b/sdk/src/ui/UIInteractionPlugin.ts@@ -6,7 +6,7 @@ import { Input } from '../input';import type { InputState } from '../input';import type { Entity } from '../types';import type { World } from '../world';-import { isEditor, isPlayMode } from '../env';+import { playModeOnly } from '../env';import { Interactable } from './Interactable';import { UIInteraction } from './UIInteraction';import type { UIInteractionData } from './UIInteraction';@@ -24,6 +24,7 @@ import { Image } from './Image';import type { ImageData } from './Image';import type { ESEngineModule, CppRegistry } from '../wasm';import { UILayoutGeneration } from './UILayoutGeneration';+import { SystemLabel } from '../systemLabels';import type { UILayoutGenerationData } from './UILayoutGeneration';const vpCache = createInvVPCache();@@ -74,8 +75,6 @@ export class UIInteractionPlugin implements Plugin {(input: InputState, camera: UICameraData, layoutGen: UILayoutGenerationData) => {events.drain();- if (isEditor() && !isPlayMode()) return;-const interactionEntities = world.getEntitiesWithComponents([UIInteraction]);for (const entity of interactionEntities) {const interaction = world.get(entity, UIInteraction) as UIInteractionData;@@ -172,7 +171,7 @@ export class UIInteractionPlugin implements Plugin {}},{ name: 'UIInteractionSystem' }- ), { runAfter: ['UILayoutSystem'] });+ ), { runAfter: [SystemLabel.UILayout], runIf: playModeOnly });const buttonInitialized = new Set<Entity>();diff --git a/sdk/src/ui/UILayoutPlugin.ts b/sdk/src/ui/UILayoutPlugin.tsindex c92d7267a..b300e0d66 100644--- a/sdk/src/ui/UILayoutPlugin.ts+++ b/sdk/src/ui/UILayoutPlugin.ts@@ -1,6 +1,7 @@import type { App, Plugin } from '../app';import { registerComponent } from '../component';import { defineSystem, Schedule } from '../system';+import { SystemLabel } from '../systemLabels';import { Res } from '../resource';import { UIRect } from './UIRect';import { UIRenderer } from './UIRenderer';@@ -59,13 +60,13 @@ export class UILayoutPlugin implements Plugin {[Res(UICameraInfo)],layoutOnlyFn,{ name: 'UILayoutLateSystem' }- ), { runBefore: ['UIRenderOrderSystem'] });+ ), { runBefore: [SystemLabel.UIRenderOrder] });app.addSystemToSchedule(Schedule.PostUpdate, defineSystem([],() => { module.transform_update(registry); },{ name: 'UITransformFinalSystem' }- ), { runAfter: ['ScrollViewSystem', 'ListViewSystem'], runBefore: ['UIRenderOrderSystem'] });+ ), { runAfter: [SystemLabel.ScrollView, SystemLabel.ListView], runBefore: [SystemLabel.UIRenderOrder] });}}