In-Game Console
Last updated
Last updated
This Component gives you an in-game console that provides Logs and Alerts from Unity, but at runtime within your game. This can be used for debugging on the actual device, without using a development build. A prefab is included in the module and can be dragged into your scene hierarchy.
The console should be hidden at start. You can use a GC Trigger set to On-Start and the GC Action to set the Canvas Alpha to zero.
Next, add a GC Trigger to open the Console Canvas. You can set this up with a Condition and toggle a bool so the same Trigger will open and close the Console, or you can open and close it with a Button, as shown in the Mobile Example. We also suggest that you set the Player to Is Controllable False, especially on a mobile to hide the Touchstick, and disable the Camera Orbit and Zoom while the Console Window is open, although this is not mandatory.
The Console Prefab has two scripts, In Game Console and Sys Info Extended. The SysInfo script should only be changed if you are creating your own or modifying the prefab. However, the in Game Console script allows you to use Admin Mode. This mode will allow you to:
Disable Commands
Disable Updates (those commands with parameters
Disable Unity Error logs.
You can configure these when developing, or change them at runtime using a GC Call Method Action.
The Console window itself is self explanatory. The SysInfo Button toggles the Realtime System Information, and the Clear button clears the log. The System Information provides Platform data and Realtime Performance data. This display also provides build data such as the Version of Unity used and the System Language. The Verified App Integrity display True if the App has not been tampered with, of False if it has. You can use this as an anti-piracy check because it checks if the application was altered after being built.
Entering a ? in the command line will display the current commands that are available, including any that you have created yourself using the provided Template. In the screen shown below, the globalsU (updates a global variable value) and event (triggers a GC event) are update commands and require parameters. These will be disabled if the Disable Updates check box is selected in the Admin Script.
The In-Game Console comes with a Template Script for creating custom commands and this is detailed in a tutorial below.
Creating GC Events to trigger game events is also covered in a following tutorial or in the Game Creator documentation.