Big List of Defold Pro Tips!


Thank you for sharing your solution. Nowadays most Defold devs add a dependency to RenderCam or Defold-Orthographic and call it a day. Those extension do more or less what you did but nicely abstracted away and with more added benefits such as camera effects, camera follow, zoom and so on.


Thank you for the advice! I’ll look into both RenderCam and Defold-Ortho. It seems that my current setup only works for games that just use the default camera (ie. no camera).


How cost effective is the hash function?

Would it make sense to create a hashed module that contains all actions for the game and load them at startup or load them in the init function of each game object/gui script?


Hash is fast, but it’s still more efficient to pre-hash everything. See this thread for other ways to do it Is calling hash() every time inefficient?


Also, it’s good to keep all the pre-hashed values in variables so that you don’t accidentally misspell something.


Just little insight that maybe some newcomer didnt notice, in GUI when you want to sort like where the render first (Node), it must in order from the top to bottom list. To make sure you wanna move it, just press “alt + up” or “alt + down” to reorder the nodes…


The above tip for rearranging nodes is good for simpler UIs. For more complex GUI scenes you’re likely to want to use hierarchies and layers.