Search Results for

    Show / Hide Table of Contents

    Debug Commands

    DebugCommand is an attribute that can be placed on classes, fields, methods, and properties to expose them for configuration, modding, or tooling.

    Tip

    Only static members can be used in debug commands.

    Access

    Output Log

    Debug Commands in Output Log

    Output Log is Editor window that displays the full log. At the bottom of that window, there is an input command field that can be used to run commands. You can type commands with an automatic search popup that displays similar commands based on the entered value. Use arrow keys to navigate around that popup list. The tab key can be used to autocomplete commands based on the best-found match. Finally, when input is empty you can use the arrow up key to navigate around the command history and re-try one of them again.

    In-game console

    Debug Commands In Game

    Debug Commands can appear within an in-game console or debug tooling. For example, Arizona Framework implements console via ImGui. Such tool can be useful when developing games for various platforms and devices such as consoles where game configurations can be tweaked at runtime.

    DebugCommands API

    Use DebugCommands class to execute or list debug commands within the project. It caches all commands for engine, game, and plugin projects.

    Example usage:

    • C#
    • C++
    // Disable vsync
    DebugCommands.Execute("Graphics.UseVSync false");
    
    // Disable vsync
    DebugCommands::Execute(TEXT("Graphics.UseVSync false"));
    

    Example

    • C#
    • C++
    using FlaxEngine;
    
    /// <summary>
    /// Global gameplay configs.
    /// </summary>
    [DebugCommand]
    public static class GameGlobals
    {
        /// <summary>
        /// Disables player damage.
        /// </summary>
        public static bool GodMode = false;
    }
    
    /// <summary>
    /// Player script.
    /// </summary>
    public class PlayerLogic : Script
    {
        /// <summary>
        /// Player speed scale.
        /// </summary>
        [DebugCommand]
        public static float SpeedScale = 1.0f;
    
        /// <summary>
        /// Restores player HP to max.
        /// </summary>
        [DebugCommand]
        public static void HealPlayer()
        {
            //..
        }
    }
    
    // Global gameplay configs.
    API_CLASS(Static, Attributes="DebugCommand") class GAME_API GameGlobals
    {
        DECLARE_SCRIPTING_TYPE_NO_SPAWN(GameGlobals);
    public:
        // Disables player damage.
        API_FIELD() static bool GodMode;
    };
    
    // Player script.
    API_CLASS() class GAME_API PlayerLogic : public Script
    {
        API_AUTO_SERIALIZATION();
        DECLARE_SCRIPTING_TYPE(PlayerLogic);
    public:
        // Player speed scale.
        API_FIELD(Attributes="DebugCommand") static float SpeedScale;
    
        // Restores player HP to max.
        API_FUNCTION(Attributes="DebugCommand") static void HealPlayer();
    };
    
    • Improve this Doc
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat