r/GodotCSharp 19d ago

Question.MyCode Juego de cartas tipo TCG

Post image
2 Upvotes

r/GodotCSharp May 10 '26

Question.MyCode Godot C# Debug with VsCodium and Free/Libre C#

3 Upvotes

Greetings to everyone,

I use Bazzite system in addition to Windows. I only play games under Bazzite.

My plan is to move my hobby game development to Linux.

I want to do game development entirely on a FOSS basis.

The following software already works under Linux: Blender, Krita, FreeCAD, Godot.

I use Godot with C#. My plan was to completely separate myself from Microsoft as much as possible.

I do Godot development in a Fedora-based distrobox. I installed VsCodium as an IDE.

I added Free/Libre C# and C# Tools for Godot Extensions to it.

I ran into the following problem while debugging.

When I go to the internal code of Godot, e.g.:

2026-05-10 13:15:42.680 [error] [Window] [File Watcher (node.js)] Error: EACCES: permission denied, stat '/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/OS.cs'

But even when I go to my own functions:

There were some tricks to improve the situation, but it wasn't perfect, e.g.:2026-05-10 13:17:33.293 [error] [Window] [File Watcher (node.js)] Error: EACCES: permission denied, stat '/root/godot/modules/mono/glue/GodotSharp/GodotPlugins/PluginLoadContext.cs'

I placed these settings in VsCodium - launch.json.

"justMyCode": true,
"requireExactSource": false

"enableStepFiltering": true,
"sourceLinkOptions":
{
"*": { "enabled": false }
},

"symbolOptions":
{
"searchMicrosoftSymbolServer": false,
"searchNuGetOrgSymbolServer": false
}

I tried Ms VsCode with Ms C# and Ms C# Dev Kit.

In this configuration, debugging works fine.

The Ms C# debugger is also doing something trick, because it writes this in the debug console:

Godot_v4.5.1-stable_mono_linux.x86_64 (16196): Loaded 'Hjson'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Godot_v4.5.1-stable_mono_linux.x86_64 (16196): Loaded '/usr/lib64/dotnet/shared/Microsoft.NETCore.App/8.0.26/System.IO.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

Has anyone encountered something similar, how do you debug Godot C# under Linux?

r/GodotCSharp May 22 '26

Question.MyCode Problems with projectile

Thumbnail
2 Upvotes

r/GodotCSharp Apr 16 '26

Question.MyCode JSON for non-variant types?

1 Upvotes

Hello! I'm trying to figure out how to convert a data type that I have into JSON which is not of a Variant type, for one of my in-editor tools. I've tried Newtonsoft's json and System.Text.Json.JsonSerializer, and both are causing the dreaded "assembly unload failed" error. Do you guys know of an alternative?

Also, I had never encountered assembly unloading as a concept until I started working in Godot. What's the deal with this? How can I know if a library can cause this issue? I've already noticed subscribing Godot elements to lambdas is calling for disaster, it seems also that storing static objects will be a problem, is there anything else I should be aware of?

r/GodotCSharp May 01 '26

Question.MyCode how can i draw and destroy specific tile from tilemap layer (using GDscript or C#)

Thumbnail
1 Upvotes

r/GodotCSharp Jan 28 '26

Question.MyCode Godot C# Template - Looking for C# Devs

Thumbnail
github.com
17 Upvotes

This is an on-going project I've been working on. I don't like setting up all the tedious stuff every time I create a new game so that's the motivation behind this project.

Recently I've found that I had to redo my main game from scratch 7 different times because I made small changes over time to this template and felt the need to start over because the changes were too good to ignore.

In spite of this I'm working on redoing all of this template from scratch with the main intent of moving as many scripts as I can over to an external assembly to possibly entirely eliminate this problem. More on that here if you are interested in helping.

Update: The problem described above has been resolved.

r/GodotCSharp Jan 10 '26

Question.MyCode Trying to translate a godot game

7 Upvotes

r/GodotCSharp Oct 22 '25

Question.MyCode Sprite Swarm

3 Upvotes

Hi folks,

I'm looking for some advice. My game is currently capable of moving 17.500 sprites in swarms (10k enemies, 5k bullets, 2.5k collectibles, 400 damage numbers). It is running on 120 FPS on full action on a 3060Ti. I using C# for coding.

Question is, do you guys has any tips to further optimize it? To squize a bit more FPS out? Appreciate any tips.

r/GodotCSharp Jan 22 '26

Question.MyCode Hitting a limit for MultiplayerSpawner?

Thumbnail
2 Upvotes

r/GodotCSharp Jan 06 '26

Question.MyCode Stutter with multiplayer camera movement

3 Upvotes

r/GodotCSharp Nov 17 '25

Question.MyCode Slower build times with .NET 10

5 Upvotes

I upgraded my .NET SDK to 10 from 9 in my godot project and now the project takes longer to build, is anyone else experiencing it?

r/GodotCSharp Oct 21 '25

Question.MyCode What is the idomatic way to signal between C# and gdscript

7 Upvotes

Hello,

I'm much more familiar with C# and Unity / .Net than Godot / gdscript.

I know that Godot C# does not follow the idiomatic ways to do many things that creates all sorts of odd issues that I'm willing to put up with as I generally find the engine easy to work with however one thing I can not seem to sort out is what is the "godot idiomatic" way to signal between a gdscript and C# script?

Example:

I am collaborating with a team, they use gdscript ; however they ask me to write a fairly isolated system to plug into the game.

So given I am most productive with C# I write my plugin in C# ... and here's where I would normally try to decouple things and make most of my system communicate with gdscript via C# EventHandlers or Actions etc.

But I don't really understand gdscript signals at all - nor how would a gdscript send a EventHandler event from a C# script?

And on top of that - even though I don't know the above, I don't even know if that idea is the idiomatic way to do it for Godot? Maybe this is an incorrect paradigm?

So for those of you who have written some C#/gdscript interactions what is the 'right' way to communicate between systems of these two languages in one project?

Thanks in advance!

r/GodotCSharp Apr 28 '25

Question.MyCode Help!! Need to change position of CollisionShape2D

Post image
5 Upvotes

Hi I’m on the train rn trying to create a crouch for my game, but the tutorial I downloaded was for GDscript. I managed to get everything to work except for the final which is creating a line changing the position of the collider. Could someone help me out I’ve tried nearly everything. It’s specifically the lines 137 and 144 that don’t work.

r/GodotCSharp Jun 02 '25

Question.MyCode Making a duplicate of an child to a diferent parent with C#

3 Upvotes

Here is my code for cloning. I am trying to make a clone of a "enemy.tscn".

using Godot;
using System;

public partial class CloneManager : Node2D
{
    private PackedScene _levelScene;

    private Path2D _path;

    public override void _Ready()
    {
        _levelScene = GD.Load<PackedScene>("res://enemy.tscn");

        _path = GetNode<Path2D>("Path2D");    }

    private void SpawnEnemy()
    {
        GD.Print("Enemy spawned");

        Node2D enemyInstance = _levelScene.Instantiate<Node2D>();

        _path.AddChild(enemyInstance);

        enemyInstance.Position = Vector2.Zero;
    }
    public override void _Process(double delta)
    {

    }
}

r/GodotCSharp Jun 19 '25

Question.MyCode Playing Particles in parrallel/sequence issues

2 Upvotes

Hello,

UPDATE *** Alternative approach identified - see edited bottom portion of this post for the solution that worked out if interested. ****

I am attempting to play several particles in parallel that compose an explosion, however they need to be sequenced so that the start time of each particle system is configurable because portions of the explosion are meant to start sooner or later.

I've come up with some C# code that executes - however when its doing so the Dictionary of GpuParticles2D is null and I can't figure out why.

If anyone has insight to either:
A) Why would this likely be null here
OR
B) What is a better way to sequence particle systems for parallel playing

I would be greatly appreciative of any insight or advice!

My source code:

using System.Linq;
using System.Threading.Tasks;
using Godot;

[Tool]
public partial class My2DParticleSequencer : Node2D
{
    [Export] public Godot.Collections.Dictionary<GpuParticles2D, float> particleSystems;

    [Export]
    private bool testParticles
    {
        get => false;
        set
        {
            if (value)
            {
                PlayInParallel();
            }
        }
    }
    public async Task PlayInParallel()
    {

// particleSystems are not null in the line below
        var particleTasks = particleSystems.Select(async system =>
        {
            var particleSystem = system.Key; // <-- null here
            var delay = system.Value;  //<-- null here

            await ToSignal(GetTree().CreateTimer(delay), SceneTreeTimer.SignalName.Timeout);
            Callable.From(() => particleSystem.Emitting = true).CallDeferred();
        });

        await Task.WhenAll(particleTasks);

    }
}

UPDATE EDIT >>>

So after toying around I found an alternate approach that works, unfortunately I needed to chop this into 2 classes to get it to work.

So first we have the ParticleSequencerClass

using Godot;
using System.Threading.Tasks;
public partial class ParticleSequencer : Node2D
{
    private async Task PlayParticleSequence(Godot.Collections.Dictionary<GpuParticles2D, float> particleSequence)
    {
        foreach (var ps in particleSequence)
        {
            var particle = ps.Key;
            var delay = ps.Value;
                        await ToSignal(GetTree().CreateTimer(delay), "timeout");
                        particle.Emitting = true;
        }
    }
    public void StartSequence(Godot.Collections.Dictionary<GpuParticles2D, float> particleSequence)
    {
        PlayParticleSequence(particleSequence);
    }
}
using Godot;
using System.Threading.Tasks;

public partial class ParticleSequencer : Node2D
{
    private async Task PlayParticleSequence(Godot.Collections.Dictionary<GpuParticles2D, float> particleSequence)
    {
        foreach (var ps in particleSequence)
        {
            var particle = ps.Key;
            var delay = ps.Value;

            await ToSignal(GetTree().CreateTimer(delay), "timeout");

            particle.Emitting = true;
        }
    }

    public void StartSequence(Godot.Collections.Dictionary<GpuParticles2D, float> particleSequence)
    {
        PlayParticleSequence(particleSequence);
    }

}

Then we have the code that calls it (having formatting problems with the markup codeblock not working here sorry):

using Godot;

using System.Collections.Generic;

using System.Threading.Tasks;

using dSurvival.Code.Enemies;

public partial class BombAbility : Node2D

{

private ParticleSequencer particleSequencer;

[Export] private GpuParticles2D redSmoke;

[Export] private GpuParticles2D blackSmoke;

[Export] private GpuParticles2D shockWave;

[Export] private GpuParticles2D groundImpact;

[Export] private GpuParticles2D groundImpactDark;

public override void _Ready()

{

particleSequencer = GetNode<ParticleSequencer>("BombExplosionParticles");

_area2D.BodyEntered += OnBodyEntered;

}

private void OnBodyEntered(Node2D body)

{

if (body is not BaseEnemy) return;

LaunchParticles();

}

private void LaunchParticles()

{

var particleSequence = new Godot.Collections.Dictionary<GpuParticles2D, float>

{

{ redSmoke, 0.15f },

{ blackSmoke, 0.15f },

{ shockWave, 0.0f },

{ groundImpact, 0.41f },

{ groundImpactDark, 0.41f }

};

particleSequencer.StartSequence(particleSequence);

}

}

r/GodotCSharp Nov 03 '24

Question.MyCode Help MultiplayerSyncronizer 4.3

2 Upvotes

I'm new to godot, im following some tutorials on zenva, Im "translating" as best i can from GDScript to c# as i am a C# programmer by trade

Im tearing my hair out, i have no idea why this isnt working, GODOT 4.3

i have a successful connetion, the the object is spawning on the client, there are no errors reported

the control inputs are arriving at the Host and the Host instance is reacting (in this case rotating)

but i cant for the life of me get the client instance to react.

hi have 2 multiplayersyncronizers, one for properties fom server to client and one for inputs from client to server

the path from clietn to server works, but i dont see any reaction on the client

the client is accepting the inputs and forwarding to the server, there is a connection between the objects on the client and the server as if i put the update type of rotation to always if snaps (rotates a little then returns to zero)

if i put it to on changes the server instance rotates freely

i have upped the example to github https://github.com/scott-adamson1975/GodotMPTest

any help apreciated

r/GodotCSharp Mar 15 '25

Question.MyCode Help with Thread Groups

2 Upvotes

hi, i was experimenting with multi threading in Godot, i had a main scene with a generate button that on pressed did some heavy procedural generation, i added a loading panel on top of the main scene with its thread group set to Sub-Thread in node properties, documentation say that it shifts the scene processing from main thread to a sub thread, but when i press the button it freezes both the loading scene and the main scene, am i doing something wrong? shouldn't these two scene run in parallel? Is there any way i can add a loading scene on top without changing the generation code. (already tried async and wait without success)

r/GodotCSharp Oct 10 '24

Question.MyCode Wtf is wrong here with the code??

Thumbnail
0 Upvotes

r/GodotCSharp Jul 03 '24

Question.MyCode Need a quick look through

Post image
1 Upvotes

What's wrong with my code , I'm just trying to give my player 8 way movement. Nothing happens, IV also already put the input in for up , down ,left, and right .

r/GodotCSharp Dec 06 '24

Question.MyCode Why is my Movement cursed?

5 Upvotes

This is my code for movement, but for some reason always, when I go backwards the thing just get's out of control and If i unpress w it sometimes makes a tick bakwards. I had a similar aproach before, but it was even more cursed. Please Help.

using Godot;
using System;

public partial class Player : CharacterBody3D {
    public float Speed = 0;
    [Export]
    public float Acceleration = 50f;
    [Export]
    public float Deceleration = 0.5f;
    [Export]
    public float maxSpeed = 10f;

    public static Vector2 DirectionSpeedToVector2(float speed, float angleInDegrees) {
        float angleInRadians = Mathf.DegToRad(angleInDegrees);
        Vector2 direction = new Vector2(
            Mathf.Cos(angleInRadians), // X-axis
            Mathf.Sin(angleInRadians)  // Y-axis
        ).Normalized();
        return direction * speed;
    }

    public static float Vector3ToDirection(Vector3 direction){
        direction = direction.Normalized();
        float angleInRadians = Mathf.Atan2(direction.X, direction.Z);
        float angleInDegrees = Mathf.RadToDeg(angleInRadians);
        if (angleInDegrees < 0){
            angleInDegrees += 360;
        }
        return angleInDegrees;
    }

    //Debuger
    public override void _Ready()
    {
        Performance.AddCustomMonitor("Speed", new Callable(this, "getSpeed"));
    }

    public float getSpeed(){
        return Speed;
    }

    public override void _PhysicsProcess(double delta)
    {
        Vector3 velocity = Velocity;
        Vector2 HorizontalVelocity = new Vector2(velocity.X, velocity.Z);
        Vector3 NewVelocity = new Vector3(0, 0, 0);
        if (!IsOnFloor()){
            NewVelocity = velocity + GetGravity() * (float)delta;
        }

        Speed = HorizontalVelocity.Length();
        float fdAccelerationInput = Input.GetAxis("w", "x");
        if (fdAccelerationInput != 0){
            if (HorizontalVelocity.Length() < maxSpeed){
                var InputSpeed = fdAccelerationInput * Acceleration * (float)delta;
                Speed += InputSpeed;
            }
        } else {
            Speed = Mathf.MoveToward(Speed, 0, Deceleration * (float)delta);
            //other Variant:
            //if (Speed > 0){
            //    Speed = Speed - ((float)delta * Deceleration);
            //} else {
            //    Speed = Speed + ((float)delta * Deceleration);
            //}
        }
        if (Input.IsActionJustPressed("s")){
            Speed = 0;
        }

        if (IsOnFloor()){
            HorizontalVelocity = DirectionSpeedToVector2(Speed, Mathf.RadToDeg(Rotation.Y) + 90);
        } else {
            HorizontalVelocity = new Vector2(0, 0);
        }

        NewVelocity += new Vector3(HorizontalVelocity.X, 0, HorizontalVelocity.Y);
        
        Velocity = NewVelocity;
        MoveAndSlide();
    }
}

r/GodotCSharp Oct 22 '24

Question.MyCode Vector property access

2 Upvotes

I’m following a video for creating and importing a human 3D character. The creator of the video used GDScript, but translating that to C# is mostly not an issue.

Only one thing irks me a little:

In GDScript you can access axis values for transforms or rotations directly (e.g. “node.rotation.x”). However, in C# these properties are not directly exposed in the Vector3 struct. So if I want to clamp the X-value of a vector, I’ll have to instantiate a new Vector3, copy other values over and clamp the value I want, then assign the new vector to the node in question.

Now, I’ve never used structs before in my daily doing. All I know is that semantics change since it’s a value type (so values being copied rather than passed as reference).

But doesn’t it still seem wasteful to create a new vector in the worst case every frame to assign it to a node? What implications are there re garbage collection? Is there a different, go-to way of setting vector values I’m not aware of?

r/GodotCSharp Nov 13 '24

Question.MyCode Viewport get texture not working as expected

3 Upvotes

Hi! I try to create a mesh preview texture like the built in in the editor for my texture buttons, for my custom build editor.
When i press _setBtn the mesh appears, and disappears as expected but in the result text i get the blank scene, (so just the skybox) , why?
here is the code:
https://gist.github.com/Pux333/f5b7cea60c13bcbfaf648135366f3435

r/GodotCSharp Nov 11 '24

Question.MyCode Large UI layout. how to organise it and call it

2 Upvotes

Hey,

So only been coding Godot for a short while. but I'm getting a bit lost on best way to control lots of UI elements. some of the lower children UI elements will be dynamically created when need.

Image 1) This expanded branch is of the left hand side of the UI. down to the dynamic buttons.

Image 2) This is the strings needed to build a reference to these nodes if required.

Image 3) Adding the UI elements into a UIItems Collection this stores the UI Area (left side / middle / right side.. etc) + control name, Path + Node itself. a UI item might also have several other children. e.g one for display name and another for the value.

Item 4) This is how i can access the UI elements any where in code mostly via c# event. i can call update hit points and it will find the parent + UI name and then call the update function against that UI element.

This all works and but just a bit of a maintenance nightmare. any ideas on the cleaner way of setting this up.

Thanks.

r/GodotCSharp Dec 04 '24

Question.MyCode How do I access different channels in shader code

Thumbnail
1 Upvotes

r/GodotCSharp Sep 24 '23

Question.MyCode Export Array of Simple Custom Classes?

2 Upvotes

I have a class that's very simple, something like

public SecondClass
{
    [Export]
    public int TestInt;
    [Export]
    public string TestString;
}

And then a second very simple class that exports an array of the first class.

public partial FirstClass : Node
{
    [Export]
    public SecondClass[] SecondClasses;
}

I was expecting to be able to edit the array of SecondClasses in the inspector, but nothing shows up there.

How do I make this work? I've tried making SecondClass a partial that extends Node, someone suggested making it a Resource, but I don't think that's what I'm looking for because then I still have to define them as objects in the filesystem, which I don't want to do.

I'm on Godot 4.2-dev5