Godot Version
Godot v4.6.1 .NET
Question
Hi, i’m new at Godot and I can’t figure out this error.
I have a scene named Game.tscn and I atattched a GameController.cs script to its root, but when I try to run the game it gives me this error:
E 0:00:00:618 can_instantiate: Cannot instantiate C# script because the associated class could not be found. Script: ‘res://Scenes/Game.tscn::CSharpScript_dctr5’. Make sure the script exists and contains a class definition with a name that matches the filename of the script exactly (it’s case-sensitive).
I checked the file and script name and they are the same, also I checked if theres compiling issues and there aren’t, I rebuilded the solution and builded the project many times and it didn’t work, I asked to ChatGPT but it gave me wrong solutions. This is my code, but I think its all OK:
using Godot;
public partial class GameController : Node2D
{
private RandomNumberGenerator seed = new RandomNumberGenerator();
public override void _Ready()
{
seed.Randomize();
GD.Print("Seed: " + seed.Randi());
}
public RandomNumberGenerator GetSeed() => seed;
}