Editor icon indicating copy to clipboard operation
Editor copied to clipboard

Bug: Script path shows as "undefined" in UI

Open Quas94 opened this issue 3 years ago • 5 comments

Hi @julien-moreau , hope you don't mind me pinging you. Thanks for creating this amazing tool!

I'm on Babylon Editor v4.3.0. I'm also pretty new to the editor so I'm not sure if this is a new or existing issue from older versions.

I was following the "Attaching Scripts" tutorial from the Babylon official docs for the editor, and when I try to attach a script to a mesh, the path shows as "undefined" rather than the actual path. See screencap:

babylon_editor_bug

Quas94 avatar Jun 25 '22 09:06 Quas94

It also seems that this isn't purely a UI bug.

Upon trying to attach the script, and "Path" showing the value undefined, I'm no longer able to delete the script using the Assets Browser (due to script being in-use). I thought this was a good sign, thinking that maybe this was purely a UI bug.

However, upon continuing to follow the tutorial (https://doc.babylonjs.com/extensions/editor/scripting/attachingScripts#rotating-the-cube-using-the-attached-script), I'm unable to make my cube spin. I've updated the class to extend Mesh instead of Node, and also changed onUpdate to set this.rotation.y += this._speed; - however upon pressing Play in the editor, my cube is still static.

I also tried adding some console.logs to the constructor and to onUpdate, none of which are printing in the devtools console.

What's interesting is that the Exported Values underneath the Script section is showing my exported _speed variable:

babylonjs_editor_bug

Quas94 avatar Jun 25 '22 09:06 Quas94

I just noticed that there was another issue opened with someone else getting the exact same problem, but on a Mac: https://github.com/BabylonJS/Editor/issues/383

Apparently running as sudo fixed everything for them

Unfortunately I'm on Windows, and right clicking + Run as Administrator didn't have any effect for me.

Quas94 avatar Jun 25 '22 09:06 Quas94

I'm having the same issue on Windows 10 x64. Unless there is a workaround, that's a pretty breaking/blocking bug.

ErikRDavis avatar Jul 29 '22 19:07 ErikRDavis

Hi @ErikRDavis @Quas94 ! I haven't found non-breaking change solution at the moment. To fix your issue, I suggest that you add all your scripts (that you link in the editor) in the "scenes" folder available in the "src" file. All scripts are collected from this scenes folder.

julien-moreau avatar Aug 15 '22 20:08 julien-moreau

Hey @julien-moreau, yeah I should have given an update since my comment, but I have it working now in the manner you described. I come from a mostly Unity3D background and so had made a folder called "scripts" on the same level as the "scenes" folder, without knowing the editor currently expects all scripts to be located under "scenes", and expected it to work. So no bug in my case, just user error! 😎

ErikRDavis avatar Aug 16 '22 18:08 ErikRDavis