Chickensoft.Platform 0.6.0-godot4.4.0-dev.7

This is a prerelease version of Chickensoft.Platform.
dotnet add package Chickensoft.Platform --version 0.6.0-godot4.4.0-dev.7                
NuGet\Install-Package Chickensoft.Platform -Version 0.6.0-godot4.4.0-dev.7                
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="Chickensoft.Platform" Version="0.6.0-godot4.4.0-dev.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chickensoft.Platform --version 0.6.0-godot4.4.0-dev.7                
#r "nuget: Chickensoft.Platform, 0.6.0-godot4.4.0-dev.7"                
#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 Chickensoft.Platform as a Cake Addin
#addin nuget:?package=Chickensoft.Platform&version=0.6.0-godot4.4.0-dev.7&prerelease

// Install Chickensoft.Platform as a Cake Tool
#tool nuget:?package=Chickensoft.Platform&version=0.6.0-godot4.4.0-dev.7&prerelease                

🧩 Platform

Platform-specific native extensions for Godot, written in C# and compiled ahead ahead-of-time (AOT).


<p align="center"> <img alt="Platform" src="icon.png" width="200"> </p>


✅ Features

Right now, this project simply provides a way to determine the actual scale factor of the display a Godot window is located on. Godot does not determine the actual scale factor and cannot provide enough information to determine it accurately, so we use various native API's to determine the true scale factor.

  • ✅ Determine scale factor on macOS.
  • ✅ Determine scale factor on Windows.

📦 Installation

You can download the zip file from the releases. For a better experience, consider using GodotEnv to install and manage it as an addon in your project. In your addons.json file, place the following:

{
  "$schema": "https://chickensoft.games/schemas/addons.schema.json",
  "addons": {
    "platform": {
      "source": "zip",
      "subfolder": "platform",
      "url": "https://github.com/chickensoft-games/Platform/releases/download/0.4.0/platform.zip"
    }
  }
}

Then, run godotenv addons install. You should see a directory named platform in your project's addons directory.

You can easily invoke the extension from GDScript:

func _ready() -> void:
  var displays = Displays.new()
  var scaleFactor = displays.GetDisplayScaleFactor(get_window())
  print("scale factor: ", scaleFactor)

🤔 Why?

The reason this project exists is because ordinary managed C# assemblies loaded by Godot don't have access to the Godot parent process' memory. We need to be able to take the native window pointer provided by Godot and use it with the OS API's — something that can only be done from a native library loaded by Godot. Accessing pointers from Godot does not work when hosted as a managed assembly.

🛠️ Building

.NET AOT compilation does not support cross-OS builds yet. You'll only be able to build a few variants on a single OS.

You can use the included build.sh script to create the assemblies for your platform.

./build.sh macos
./build.sh linux
./build.sh windows

🤗 Contributing

This uses the godot-dotnet C# GDExtension bindings that are still being actively developed. Since godot-dotnet isn't published yet, we've added a nuget.config file to the project which contains the nightly package feed.

Note that you can enumerate all versions of godot-dotnet available for use by running:

nuget list -Source godot-dotnet -AllVersions -Prerelease

It helps if you have read some of the relevant documentation:

As of right now, the warning IL2104: Assembly 'Godot.Bindings' produced trim warnings shown during build is a known issue. It doesn't prevent anything from working, however.

There is a Godot sandbox project in sandbox/Chickensoft.Platform.Sandbox that you can run to test the library manually on the platforms you have built for. It has a readme with instructions on how to get it running.

🙋‍♀️ Open Questions

Help wanted! We have a few outstanding open questions that we are seeking feedback on:

  • godot-dotnet: Can we have reloadable GDExtensions written in C#?
  • C#: Can we create native iOS libraries (XCFrameworks)?
  • C#: Can we create native android libraries? It seems possible.
  • Linux display scaling: it should be possible to implement display scale factor detection on linux if Godot does not provide an accurate scale factor. This could be done by detecting whether the environment is X11 or Wayland, and then invoking methods in libX11.so or libwayland-client.so, respectively.

If you know the answer to any of these, please open an issue or reach out to us in Discord! We are eager to support more platforms and improve this project.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Chickensoft.Platform:

Package Downloads
Chickensoft.GameTools

A collection of tools for accelerating Godot + C# game development.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.6.0-godot4.4.0-dev.7 51 1/19/2025

Chickensoft.Platform release.