Godot
This page shows how to add and use any regular C#/.NET SDK (distributed as a NuGet package or a DLL) inside a Godot 4 project that uses C#. It assumes you’re using the .NET build of the Godot editor.
Prerequisites
Install the Godot .NET editor build (not the standard build) (Godot Engine Documentation)
Install .NET SDK 8.0 or newer (Godot 4.4 targets .NET 8 by default, but .NET 9.0 is also supported and recommended) (Godot Engine, Godot Engine Documentation)
An IDE that supports C# (VS Code, Rider, or Visual Studio)
Create or enable a C# project
Open Godot (.NET) → create a project
Add your first C# script (Godot will generate a
*.csproj
for you)Build once to let Godot restore packages and generate bindings (Godot Engine Documentation)
Add Phantasma Phoenix C# SDK
Option A — via NuGet (recommended)
From your project folder (where the .csproj
lives), add the package (PhantasmaPhoenix.Cryptography shown here as an example, check this page for full list of available packages):
dotnet add package PhantasmaPhoenix.Cryptography
dotnet restore
Godot C# uses standard .NET projects, so NuGet packages work the same way as in any C# app (Godot Engine Documentation)
Option B — reference a local DLL
If you have a compiled PhantasmaPhoenix.Cryptography.dll
, add a reference in your .csproj
:
<ItemGroup>
<Reference Include="PhantasmaPhoenix.Cryptography">
<HintPath>addons/PhantasmaPhoenix.Cryptography.dll</HintPath>
</Reference>
</ItemGroup>
Godot recognizes regular C# project references; external managed DLLs can be added in the .csproj
file (Godot Forums, Reddit)
Minimal example
Create Scripts/ExampleSdkUsage.cs
and attach it to a Node:
using Godot;
using PhantasmaPhoenix.Cryptography;
public partial class ExampleSdkUsage : Node
{
public override void _Ready()
{
var keys = PhantasmaKeys.Generate();
GD.Print($"Address: {keys.Address.Text}");
}
}
Build the project (from IDE or dotnet build
) and run the scene. C# scripts and exported members behave like in regular Godot C# projects (Godot Engine Documentation)
Exporting the game (with C#)
Install export templates in Godot
Configure an export preset (Windows, Linux, macOS, Android, iOS)
Export your build
See Exporting projects in the official docs for platform setup and templates (Godot Engine Documentation)
Note: Web (HTML5) export with C# is not supported in Godot 4.x at the time of writing (Godot Forum)
Tips & troubleshooting
Make sure your project targets
net9.0
in the.csproj
when using Godot 4.4 packages:<PropertyGroup> <TargetFramework>net9.0</TargetFramework> </PropertyGroup>
Details: GodotSharp packages moved to .NET 8 in 4.4 (Godot Engine)
If NuGet restore fails, verify your NuGet configuration or regenerate
NuGet.Config
(common fix forGodot.NET.Sdk
not found) (Reddit)Godot uses the
Godot.NET.Sdk
MSBuild SDK in your.csproj
(managed by Godot) (NuGet)General C#/.NET how‑to for Godot (language features, exports, etc.) is covered in the official C# docs (Godot Engine Documentation)
Useful links
Godot C#/.NET docs (overview & basics) (Godot Engine Documentation)
C# basics (4.4) and exports (attributes) (Godot Engine Documentation)
Exporting projects (templates & presets) (Godot Engine Documentation)
GodotSharp packages & .NET 8 note (Godot 4.4) (Godot Engine)
Platform state of C# in Godot 4.x (what “standard .NET” means) (Godot Engine)
Last updated