Index of every page on this site: llms.txt
All skills
jame581 avatar

/csharp-godot

@426e8ab
by Jan Mesarčjame581/godotprompter979 stars
63
Run it yourself

Use when working with C# in Godot — conventions, GodotSharp API differences from GDScript, project setup, and interop

Use this Skill: https://skilld.dev/gh/jame581/godotprompter/csharp-godot

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesgdscript-interop.md

≈476 tokens on demand. Your agent reads this file only when SKILL.md points to it.

GDScript Interop

Reference for skills/csharp-godot/SKILL.md — calling GDScript from C#, calling C# from GDScript, and Variant marshalling gotchas.

← Back to SKILL.md


Calling GDScript from C#

Use Call, Get, and Set on any GodotObject. Values are marshalled through Variant.

// Assume "enemy" is a GodotObject backed by a GDScript with func take_damage(amount)
GodotObject enemy = GetNode("Enemy");

// Call a GDScript method
enemy.Call("take_damage", 25);

// Get a GDScript property
float health = enemy.Get("health").AsSingle();

// Set a GDScript property
enemy.Set("is_stunned", true);

Calling C# from GDScript

If a C# class is registered as a [GlobalClass], GDScript can instantiate and use it directly without any extra wiring:

[GlobalClass]
public partial class WeaponData : Resource
{
    [Export] public float Damage { get; set; } = 10f;
    [Export] public float Cooldown { get; set; } = 0.5f;
}
# GDScript — works because WeaponData is a [GlobalClass]
var data := WeaponData.new()
data.Damage = 50.0  # C# members keep their C# names — no snake_case conversion

Non-[GlobalClass] C# types are not visible to GDScript by name but can still be passed as Variant/Object references.

Variant Marshalling Gotchas

Scenario Issue Fix
Passing null across boundary GDScript null becomes default(Variant), not C# null Check variant.VariantType == Variant.Type.Nil
Returning int[] from C# GDScript receives a PackedInt32Array, not an Array Return Godot.Collections.Array<int> for consistent typing
Passing System.Collections.Generic.List<T> Not marshallable — Godot doesn't know this type Convert to Godot.Collections.Array<T> first
Godot Color struct Passed by value through Variant correctly No issue

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts7d3 checks · Risk SAFE
  • Gen Agent Trust Hub7d

    This skill provides documentation and best practices for using C# with the Godot game engine. It contains standard coding examples, naming conventions, and project setup instructions. No security risks were identified.

  • Socket7d

    No alerts

  • Snyk7d

    Risk: LOW · No issues

Signed by skilld at 426e8ab. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 6 days ago.

Activeupdated last week

README badge

README badge for jame581/godotprompter/csharp-godot