xyz Thank you, I will try that way and cleaning the files you told me. Thanks a lot for your time and for helping me with this.
how to use an instance of custom class in GDScript?
xyz OK. I did the following for getting it to work with my full class:
- As you said, the declaration was outside. It has to be inside
- I deleted the file with csproj extension and the old solution if existed
- I used the menu for creating the solution again
- And after that, it didn't work, and it seems it was because I had a typo in the name of my variable. The program told me it doesn't existed, because it didn't!
- After that, I tried my original code to change the TextureRect texture with a button, and it didn't work neither. I have no idea why, but I just deleted it, added a TextureRect again, and now everything works.
As now I know that my custom C# code works, I will be able to make my game. Thanks a lot, you are fantastic!
For me it was confusing that the editor didn't warn me that the variable name was spelled wrong. Usually that gives a red line in Visual Studio below the word so you know in the moment that it wasn't. I suppose that in some place or using Visual Studio or Visual Studio Code as editors it may warn me, right?
The other thing is that I don't knwo why the TextureRect stopped working, or maybe it was not visible by some reason.
intuitive-arts Something was definitely bugged out in your project. Not sure exactly what. But this in principle must work.
As for error highlighting, GDScript cannot check C# source files for errors while you're typing (i.e. prior to runtime). It can only do so for its own code. C# is not as well integrated into Godot as GDScript.
xyz thanks for everything. I think I may rewrite all in GDScript.