fix(framework): access scene key via sys.settings in PhaserScene

Use `scene.sys.settings.key` instead of `scene.scene.key` to correctly
retrieve the scene key from the Phaser scene instance.
This commit is contained in:
hypercross 2026-04-20 15:47:56 +08:00
parent 85bc4f5400
commit 22817945cc
1 changed files with 1 additions and 1 deletions

View File

@ -215,7 +215,7 @@ export function PhaserScene<TData = {}>(props: PhaserSceneProps<TData>) {
// 注册场景到 Phaser但不启动 // 注册场景到 Phaser但不启动
const scene = "scene" in props.scene ? props.scene : new props.scene(); const scene = "scene" in props.scene ? props.scene : new props.scene();
const sceneKey = props.sceneKey ?? scene.scene.key; const sceneKey = props.sceneKey ?? scene.sys.settings.key;
if (!game.scene.getScene(sceneKey)) { if (!game.scene.getScene(sceneKey)) {
const initData = { const initData = {
...props.data, ...props.data,