Tips, Tricks and Quirks

The purpose of this page is to give you some ideas on some useful tips and tricks, and to also make you aware of some particular quirks.

Performance Tips

  • When possible and practical, create generic materials and reuse them by exposing the appopriate uniforms. When you attach a material to a mesh, the editor will let you define default values for each exposed uniform.
  • Don't create excessively large lights.
  • Use shadow-casting lights sparingly, especially point lights. Six shadow maps are generated for each point light, so it is best to only enable shadows on lights with the most impact. You can dynamically enable and disable shadow-casting via the scripting environment if needed.

There is Only a Single GUI and Scripting Environment

The engine has only a single GUI and scripting environment for everything running in the game. The editor is part of every game, which means the GUI elements in the editor are located in the same environment as those in your main game.

GUI elements are closely tied to the scripting environment. There is also only a single scripting environment in the entire game.

It's especially important to be aware of this quirk when it comes to testing scenes inside the editor. When you "play" a scene from inside the editor, the scripting will be running in the same environment as the main game. A good example is the Game.Close() function. Executing this when "playing" a scene from inside the editor will literally close the game.

Another example is creating GUI elements. When a GUI element is created when playing a scene from within the editor, it will be created as part of the main GUI environment. When you "stop" playing the scene, the GUI elements will remain in the environment if they are not deleted.