Defold Kit — Visual Studio Code Extension

I must be doing something wrong. How do I get the setup to “kick off”. It says open a defold project. But how? I opened my folder. Then I tried opening the game.project file and it just loads the file…no setup kicked off.

Edit: Finally got it work. I had to close VS Code. Then open folder. Wait a few seconds and the setup routine popped up in bottom right.

Yeap, it requires to open the project folder with the ‘Open the folder’ command.

Snippets have been improved a bit. I’ve been wanting to add automatic annotations for script lifecycle functions for a long time.

Just by typing script:

It’s also possible to add functions individually, but then still need to declare a class.

6 Likes

Hello @astrochili!

I’m trying your extension - First time using VSCode too (coming from Sublime or other IDEs) - Upon installing, not only the Setup didn’t run but I can’t even seem to load the commands.

Any clues?
Thanks!

be sure you use ‘Open Folder…’ on the one containing your game.project

2 Likes

Yes, make sure you open the project folder as @ekt mentioned, not a separate file.

1 Like

Hi!

I’m using the Defold editor. This looks like a nice extension. I have a question though, sorry for my noobiness : what is the workflow when using VS Code? In the Defold editor, I can create game objects and components and connect them together easily. Or manipulate atlases. I know these are text files only but they are easy to manipulate in the Defold editor.

How is this handled when using VS Code? I believe we cannot have both editors open at the same time. So what is the workflow?

Thanks!

Hi,

External code editors like VSCode can’t replace the collection or gui structure building at the moment (and hardly ever). It’s for coding and editing raw files.

When someone uses an external code editor - most often they use it to write code and everything else in the Defold Editor. This is especially true when content is instantiated from code rather than from pre-prepared collections.

1 Like

Ok! That’s what I understood. But I’m mainly curious about the typical workflow. For example, I imagine you’d create all game objects and components and general structure using Defold and only then use VS Code for scripts. It’s just we very often need to bounce from code to Defold “UI elements” and back. Wondering if the process is seamless. Might give it a try though. If we can have both editors open at the same time it’s no big deal. But I am not sure if we can!

Of course we can, there’s no doubt about it.

1 Like

Ok! Thanks!

Thanks I wasn’t expecting I needed to be in a project to install the kit.

Got it working now :slight_smile: Thanks!

Is it possible to run it with the Steam version of Defold? If so, how to point to the Defold application localisation?

Didn’t try it but I hope that Defold is somewhere at

-- Windows
C:\Program Files (x86)\Steam\steamapps\common\Defold\
-- macOS
~/Library/Application Support/Steam/steaapps/common/Defold/Defold.app

If it’s there then you have two options:

  • Change the value for the defoldKit.general.editorPath key manually in the VS Code global settings.

  • Or run the Setup Defold Kit command from command palette and choose Select Defold Application.

1 Like

So thaat’s where the apps are installed :smiley:

Thank you! :heart:

1 Like

Thank you very much for this extension !
I have a problem Building from VScodium. The project builds and works fine with Defold, but with VScodium I have the following error build/defoldkit/dmengine: error while loading shared libraries: libGLU.so.1: cannot open shared object file: No such file or directory
(I run everything on a SteamDeck…)
But libGLU.so.1 exists inside /usr/lib.
I’m a bit confused on how to solve this issue…

To be honest it’s hard to answer. VScodium on Linux on SteamDeck…
What if you copy this file to the build/defoldkit/ folder?
Also does bundling for your platform from Defold Editor works fine?

I will give Visual Code a try, you are right.
However, copying libGLU.so.1 to build/defoldkit (same folder as `dmengine) does not work.
And yes, bundling for the linux plateform form Defold Editor works fine, producing a running executable.

Same problem with Visual Studio Code…
Is it because I use a flatpack of Vscodium/VisualStudioCode ?

I don’t think so. Sounds like it requires really just figuring out what is missing, where and at what point. VSCode itself doesn’t do anything specific except run commands in the terminal, run jdk from the Defold folder, unpack some files from the jar, copy them…

Unfortunately I can’t suggest an easy quick way to solve this problem at the moment as I am not a Linux user. But I would suggest starting by trying to build the project through the console using bob. Defold Kit runs something like this (replace with your values):

"Defold/packages/jdk-17.0.5+8/bin/java" -cp "Defold/packages/defold-05791d87e2059524a11cbf946f47b6c87c6d1902.jar" "com.dynamo.bob.Bob.Bob" --variant debug --output build/defoldkit build