Godot.Console 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Godot.Console --version 1.1.1                
NuGet\Install-Package Godot.Console -Version 1.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Godot.Console" Version="1.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Godot.Console --version 1.1.1                
#r "nuget: Godot.Console, 1.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Godot.Console as a Cake Addin
#addin nuget:?package=Godot.Console&version=1.1.1

// Install Godot.Console as a Cake Tool
#tool nuget:?package=Godot.Console&version=1.1.1                

GodotConsole

C# console backend for Godot. This console supports tying functions to console commands and also tracking of console variables. This is intended to work with the Mono version of Godot (C#). Just drop the code in with your main project and you can start building a console and commands right away. See below for usage examples.

Repository

The main branch [origin/main] will be kept in line with the latest release of Godot. Currently it is syncing with the latest Godot 4 beta. There is a release for the Godot 3.5.x line.

Usage

Set up an in-memory logger for the console. Here we will use a BBTextTarget so custom formatting can be included when displaying in the UI.

// set up a log target for the console
var consoleLogTarget = new BBTextTarget("UIConsoleLog");

// Create a configuration for the logger and register the target
LogConfiguration config = new LogConfiguration();
config.RegisterTarget(consoleTarget);

// Set the configuration
GodotLogger.SetConfiguration(config);

// pass the log target to the console
GodotConsole.SetLogTarget(consoleLogTarget);

Register a custom console command.

GodotConsole.RegisterCommand("exit", (cmd, args) => GetTree().Quit());

Track a console variable.

GodotConsole.RegisterVariable<bool>("fullscreen", false, (cmd, args) => OnFullScreenCommand(cmd, args));

public void OnFullScreenCommand(ConsoleCommand command, object[] args)
{
    bool val = (bool)(command as IConsoleVariable).GetValue();

    OS.WindowFullscreen = val;
}

Get the contents of the log which could then be displayed in the UI, for example.

richTextLabel.Text = GodotConsole.GetText();

Pass user entered text (for the UI console, for example) to the console backend for processing.

string cmdLineText = consoleInputLineEdit.Text;
GodotConsole.ParseCommand(cmdLineText);
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 122 7/8/2024
1.2.3 94 6/23/2024
1.2.2 143 9/18/2023
1.2.1 126 9/17/2023
1.2.0 154 7/29/2023
1.1.1 138 6/18/2023