If a project is compiled in debug mode you can enter an Inspector at any time by pressing F8 or (useful on mobile) holding 3 fingers anywhere on the screen for at least 1 second.
The Inspector, first introduced in this video, is a tool to debug your game as it is running. It features an editor-like interface, to inspect your hierarchy and components, view logs, profile (measure speed) and other important tools. Recent news item alreday talked about “Monitor and Auto-Reload Data” checkbox.
We continue to extend this with more features, to make debugging and experimenting with your game as it is running more powerful.
-
The biggest feature here is that you can manipulate boolean properties as checkboxes. For example, just click on the
TCastleUserInterface.Exists
or TCastleTransform.Exists
to toggle whether something exists (is visible and collidable). Toggle TCastleImageTransform.SmoothScaling
to tell if an image is pixel-art or not. And so on.
TODO: We want to extend it to allow editing all properties at runtime, not just booleans. This improvement should come very soon, editing properties as strings is a natural extension of this idea. And naturally this is pushing us more and more into idea “implement editor using CGE UI”, something that we already committed to doing, but it’s going to take some time.
-
Pretty hierarchy rendering (no more “-” suffixes).
-
Display user interface and viewport stats (draw calls).
-
Checkbox to toggle UI batching. Select “More” and then “User Interface Batching”.
Note: you can also toggle viewport batching, just select the viewport and toggle TCastleViewport.DynamicBatching
property as a checkbox.
A natural warning: This is a debug feature that may break some assumptions in your code. If your Pascal code assumed that it controls the TCastleTransform.Exists
value (which is a perfectly valid assumption, it is true when your game is actually used by normal people!) then you can break this assumption. That’s also why the release game builds naturally don’t enable the inspector. You can control whether the inspector is possible adjusting the TCastleContainer.InputInspector
configuration — e.g. you can make inspector always disabled, or always enabled, or enabled using some other key combination.
To be enabled by default only in debug mode, inspector relies on specific project configuration set up in new project and updated by “Code -> Regenerate Project”. More specifically, the call ApplicationProperties.InitializeDebug;
in CastleAutoGenerated.pas
unit makes the inspector available (using F8 or 3 fingers). See also our recent post about “Code -> Regenerate Project”.