0 votes

Hi,

i use c#, and i want to know :

-1- i build an helper class, but i can't access my helperClass namespace in the nodeScripts...??

-2- and, how can i add references in a godot project ??

-------------------- EDIT --------------------
Ok , for the point -1-, i got it : i have to create the file.cs in the Godot EDI, not in VSCode (or i must manually update the MyProject.csproj file)

asked Apr 6, 2018 in Projects by fredaudy (20 points)
edited Apr 6, 2018 by fredaudy

2 Answers

+1 vote
Best answer

In Godot 3.0.2,m when using C#, you can use an IDE that lets you update the C# solution when adding files (like MonoDevelop or VisualStudio. Perhaps VSCode has a way to do it as well with a plugin?).
C# is not like GDScript, it needs a project file to be compiled. So if you use a text editor without project management you indeed need to do that manually, or force Godot to recreate or update the solution somehow.

Adding references is the same. If you have an IDE that lets you update the project file, then I believe you can add them that way.

answered Apr 6, 2018 by Zylann (26,129 points)
selected Apr 6, 2018 by fredaudy
0 votes

I wanted to add a class like this:

public enum State
{
    Idle,
    Empty,
    Filling,
    Dropping,
    Swapping,
    Deleting
}

public class Cell
{
    public int Row;
    public int Column;
    public int Index;
    public State State;

    public Cell(int row, int column, int index)
    {
        Row = row;
        Column = column;
        Index = index;
        State = State.Idle;
    }
}

How do you do it in Godot?

I created Cell.cs with File -> New in the scripting window - it insisted I derive from a Godot class like Node. So, I let it do that, then I removed the Node reference and made my classes like above. That got me an extra set of classes.

I don't know the answer to adding references to external assemblies.

answered May 12, 2018 by imekon (229 points)

Hello, I've got the same problem. Could you find a solution? I'd like to work from VisualStudio without the need of creating "Scrips" manually from Godot app

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.