From 0b9a65e7d33f5c2b2819f6d6e9d29f9f08352df9 Mon Sep 17 00:00:00 2001 From: PhaserEditor2D Date: Mon, 26 Jun 2023 11:59:33 -0400 Subject: [PATCH] Fixes dropping script node to an scene. --- .../src/ui/editor/undo/CreateObjectWithAssetOperation.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/editor/plugins/phasereditor2d.scene/src/ui/editor/undo/CreateObjectWithAssetOperation.ts b/source/editor/plugins/phasereditor2d.scene/src/ui/editor/undo/CreateObjectWithAssetOperation.ts index ec9eebbf1..42413ff3f 100644 --- a/source/editor/plugins/phasereditor2d.scene/src/ui/editor/undo/CreateObjectWithAssetOperation.ts +++ b/source/editor/plugins/phasereditor2d.scene/src/ui/editor/undo/CreateObjectWithAssetOperation.ts @@ -34,16 +34,16 @@ namespace phasereditor2d.scene.ui.editor.undo { || asset instanceof sceneobjects.ScriptNodeExtension; } - if (isScriptNode) { + const sel = editor.getSelectedGameObjects(); - // We are droping a script node, + if (isScriptNode && sel.length > 0) { + + // We are dropping a script node, // so we should go for every object selected in the scene // and add the script. // It is different from adding a regular game object, // where only one instance is created - const sel = editor.getSelectedGameObjects(); - const newSprites = []; const script = this._data[0];