Commands result

Commands result

Displaying command results in the Jahro console can be very handy, especially when you want to trace data flows and operational sequences in your game. It provides you with instant feedback and allows you to monitor the output of your commands in real time. Read more here.

To achieve this, simply define your command methods to return a string. This string will then be logged in the Jahro console once the command is executed. Here's an example:

[JahroCommand("root-objects")]
private static string GetRootGameObjects()
{
    string output = "Scene root objects:\n";
    var objects = SceneManager.GetActiveScene().GetRootGameObjects();
    foreach(var go in objects)
    {
        output += go.gameObject.name + " -- active: " + go.gameObject.activeInHierarchy + "\n";
    }
    return output;
}

jahro commands

In this example, the command root-objects returns a string listing all root game objects in the active scene. Once this command is executed, you'll see the list directly in the Jahro console.