Running Projects

R unning Your Projects You can launch your game application at any time by going to Project -> Build. This will by default build for your local OS, and then launch immediately. Projects built in this way are always in debug mode and not release mode.

If you are using Defold’s library system then you may need to get the latest version of your library files before making a build. Project -> Fetch Libraries will do this for you. Defold does not grab the latest version of libraries for you otherwise. Libraries need not be hosted on official Defold servers, can can be fetched from, for example, publish GitHub hosted git repositories too.

To test your app on other devices, such as on iOS or Android devices, you will need to setup the Defold development app on your device. Once you do, you will be able to select Project -> Target, and change it to your device. Then, when you make new builds, with the test device selected, it will have new build bundles uploaded to it and then ran - as long as you have the development app open and ready to accept new builds. If you hot reload files while having an active running build those resources will hot reload on the target devices.

While the Defold editor is running, it will do target discovery. If you click Project -> Target Discovery Log you will be able to see the text log of this service.

If you know the IP address of your local area network device which is running the engine you can manully enter its IP

For Android, navigate to http://d.defold.com/ on your Android device, and expand the version number of the same build as your Defold Editor’s current version. Look for “dmengine.apk” and download this to your device. Once opened, you should be able to see that Android device as an option on the Project -> Target list as long as your computer, where the Defold Editor is running on, and the Android device are on the same local network. The “AirDroid” app is a useful app to use for development as it allows remote management of your device’s filesystem. You can bundle apks and upload them to your Android device with this app. You may need to enable remote sources to install APKs directly. If you wish to test features such a IAP then you must sign your apk properly, set it up properly with Google Play Developer Console, and upload it to the Google Play store as a beta build. The developer portal for Google Play allows for uploading and downloading test builds from its service. Check the later chapter on Android for more instructions.

For iOS testing, you must be on an OS X device to make the signed build, you must first be signed up as an iOS developer, create a provisioning profile for your app (which has your test devices enabled), go to Project-> Sign iOS Executable…, select code signing identity (you may first need to set this up with Xcode)(choose iPhone Distribution option), select your provisioning profile file after having downloaded it (create for adhoc distribution), then click Sign and Upload. You will then need to go to the Defold Dashboard on the Settings tabfor your project and download the app listed there. This will download the Defold Engine app, which, once open, will then be able to have builds pushed to it once it as selected as Project Target. Check the later chapter for iOS for more instructions.

If you have the development app open and it says “Waiting for connection…”, but you can’t see the device on the target list, you can try to close and re-open the Defold Editor, close and re-open the app, or wait longer for it to show up. You can reuse the same dev apps for multiple Defold projects, but if your Defold Editor updates then you will need to go through the same processes to get new development apps on your device (you will be warned of version mismatch if you try with older versions).

If you wish to distribute your Android/iOS game so that others can test it there are more considerations necessary. See the later chapters on distributing for Android and iOS. With apps running, and launched with this method, you are able to do hot code reloading. Go to Edit -> Reload Resources when you have a script open that you wish to hot reload. Hot code reloading can sometimes break your game, which is why the “on_reload(self)” function exists to compensate for any problems. Using hot code reloading can be much faster than waiting for the entire project to rebuild and relaunch so use it! Besides scripts, you can also hot-reload shaders, and some other resource types such as Atlases, Game Objects, GUI files, but not Collections.

If you create many kinds of files or components, such as Collection Proxies, and do not properly define them then when you go to run your project there will be errors preventing you from doing so. Only create files that need full definitions when you are ready to use them. Generally when you go to run your project, while having incomplete entries, related errors will appear.

Last updated