Using Godot + C# + Visual Studio Code
Vložit
- čas přidán 10. 09. 2023
- In this step by step tutorial we show how you can create games using the Godot Game engine with the C# programming language using Visual Studio Code and the newly released C# Dev Kit.
The linked tutorial shows all the same information if you need a reference.
Links
gamefromscratch.com/c-develop...
-----------------------------------------------------------------------------------------------------------
Help Support GFS : / gamefromscratch
GameDev News : gamefromscratch.com
GameDev Tutorials : devga.me
Discord : / discord
Twitter : / gamefromscratch
----------------------------------------------------------------------------------------------------------- - Věda a technologie
Links
gamefromscratch.com/c-development-with-godot-and-visual-studio-code-tutorial/
-----------------------------------------------------------------------------------------------------------
*Help Support GFS* : www.patreon.com/gamefromscratch
*GameDev News* : gamefromscratch.com
*GameDev Tutorials* : devga.me
*Discord* : discord.com/invite/R7tUVbD
*Twitter* : twitter.com/gamefromscratch
-----------------------------------------------------------------------------------------------------------
And what about "C# Tools for Godot" addon for VSCode - this would add launch.json for godot
and on it's web site there is instruction what flags add to godot so it open file on given line when there is an error.
Hello. John Riccitiello CEO from Unity sent me here.
Howdy fellow Unity devs - nice day to try a new engine eh ?
Wassup
totally just trying out Godot for research preposes only. Totally for research
yeah right@@aditkumar4644
you already know
Yep
nice timing for those of us who wants to switch from unity to godot xD
Yeah x) exactly why I'm here
I've been waiting so long for C# to be available for Godot, even with all of the small hiccups, it's so nice to finally have it.
@@Daktyl198 Oh that's excellent, good to know, thank you.
I'm so amazed that it supports .NET 6, meaning that all the new C# 10 features are available 🤩 Unity has been stuck in C# 9 and there have been a few features I've been wanting to use but no luck until now.
One minor thing to note is that at 3:19 the Text Editor -> External is for GDScript external editor. There is a Dotnet -> Editor editor setting which can be configured for C# based scripts.
This comment is so underrated, it needs to be pinned! thank you.
Thank you, for the love of god I spent a week trying to get started like this in Unreal. Needless to say I gave up on that and came to godot and got set up with your tutorial. Thank you so much!
Great timing!! Glad I can start using C# thank you!
I was looking for this today. Thank you so much
Thank you for this! Very helpful for my needs.
Thanks for the tutorial, managed to set up environment with your help, cool that it already has working debug.
Thanks a lot for this. I use it with C++, but I could quickly adapt your tutorial to get it working with bazel build and gdb debugger.
For the newbies(myself included) @4:24 the short cut to open the command pallette is Ctrl+shift+P
or just F1...
Thank you! I was trying to figure out how he did that lol!
Perfect quick video, thanks for the tut
Dude, that was an awesome tutorial. You saved me a lot of time! I rarely subscribe, but I will do it here!
Very useful! Thanks for sharing!
You can replace all the backward slashes easily by selecting the first and hitting ctrl+D various times. Once they're all selected, type in the forward slash and it'll replace them all at once.
Thanks, it was a great video to start
Hey man,thanks u for more videos...O3DE 23.10 will arrives in October!
Nice video. Please create more C# Godot videos. AMazing.
Very well done. Thank you.
Thanks for this!
A fair warning that C# and Godot 4+ have few limitations still. Probably won't matter to most, be give a look before staring a big project
can we use both language to offset that limitation? C# for speed, and GDScript for other things? I never use C# with godot before, so I wouldn't know.
There is no fair warning here.
@@obinnaokafor6252 Could you elaborate?
@@magicalcapi9148 I have played around with Godot 4.11 and I have not encountered any limitations as you stated
@@johnavernia1026 I'm not entirely sure, from what I've experienced, Godot 4+ & C# have some issues when exporting and some big plug-ins. I had a huge issue exporting for web with Godot 4+, so I had to downgrade to 3.5.2 . There's a reason why 3.5.2 is the LTS version.
As far I remember, same for C#. I think for mobile exporting? But please correct me if I'm wrong.
If you wanna start something big, my recommendation is LTS. Most well supported so far. If you're not, not only with Godot, but pretty much any engine or tool, test it thoroughly the main features you're going to use. In special, audio, export, and render. Anything critical, check before committing long hours of a project.
Thanks a ton!
That's neat.
I might try it soon-ish, lest my C# skills decay far too much.
I'm so eager to switch to mono, but web builds are a must for me
Holy super useful Batman
Thank you!!!
Thanks gfs I've know godot for very long time because of your videos. For weeks now I switched from unity to Godot 4. Never looked back. The c# API is more elegant than Unity's.
Looks like you made the jump at the perfect time.
@@FireCrewGAMING Yeah just some weeks ahead before the unity pricing fiasco.
@@takumimayama8507 C# and .NET version are newer than the very old one used by Unity. This is not mentioned a lot but for me it's important because the language and performance evolved a lot these last years. Another very good point for Godot.
Oh so that's why the godot wild jam's 4th sudden wildcard came about
Thanks for going straight to the point, I already pressed like button 3 times :) . I have few questions:
1. Can we create a template and inject it to Godot to prevent re-config for new project in the future? Or we have to walk around by compressing the current blank project with initial settings for later use?
2. Some add-ons are written in GDScript or I am using Rust with GDExtension, if we load can invoke their functions, how could debugging work in crossing-languages?
3. Would you mind to make an instruction video about Rust configuration with gdext?
Omg. Im gonna need to migrate my project from unity asap before its too late
Nice
Perfect timing 😂
3:59 For anyone attempting 'code .' on MacOS (Apple Silicon or Intel), if you cannot launch Visual Studio Code from the terminal, use the command palette (command + shift + p) and run 'shell command: uninstall" followed by 'shell command: install'. Restart the terminal, drag/drop the current folder to the terminal icon and then run 'code .' again.
XD nice timing
What to do at 4:52 if you don't have that suggestion? I only get Node.js, Web App and Install an extension
same, did you find a solution?
yeah I don't have said suggestion either
Same. A fix would be great.
Oh great! CZcams deletes comments that say dot net so my fix comment got deleted. I'll try and post it again.
FIX: As long as you have a json file with the correct code in and the same name it will work. Select one from your list of available ones, rename it and write in the correct code. It should work fine.
Also look for the Godot extensions for VSC as I think some of them have the correct files in already.
Hopefully CZcams doesn't delete this!
Timed that well lol
Any chance you've tried this setup on a mac? My launch.json file doesn't recognize the program path parameter...It should be set for the default Godot application, not the current game project instance, correct?
Welcome, Unity users!
Can we get a tutorial for Godot 4.0 on how to use C++?
People moving from Unity maybe think about GDScript. But they have to taken in account that GDScript only works with Godot. With C# you can work with anything. Plus C# is way way faster.
Hi Gamesfromscratch, I never touched Godot before, but I've been learning C# and I've been really interested in trying to make a game using C#. Is this the only way to use C# with Godot? Or are you able to use the built-in console in Godot? I have both vs-code and Visual Studio and the process to get up and running vs-code looks painful. But you did present an excellent tutorial in how to get up and running with vs-code, thanks.
Friend, you have to click one button "create solution", and there is a VS solution in the res folder you can open, almost cant get any easier.
But C# Godot can only build for Windows right now
@@diligencehumility6971 Yea I agree, I saw last week that Visual Studio on mac will soon be deprecated on mac by 2024, very very sad.
So I just watched one of your other videos "The Future of C# in Godot" where you explain that because Godot 4 and C# currently does not allow for android, ios, or web exports. You conclude that most C# developers will be more likely to use Godot 3. I fully agree with this. I am targeting a web build, which is why I'm using Godot 3.
Unfortunately, the video is not very helpful for that same reason, as it uses Godot 4 and most things you do are not supported in Godot 3. So I would probably specify the version in the title. Lucky for me you also have some older videos covering the process with Godot 3 :)
is it still not allowed on android ios or web?
i dont even know if this is what is meant to happen with what you've shown here but i want my code written in VScode to be easily brought into Godot by pressing a button like how it works in vs and unity. currently, i can write and debug my scripts in VScode, but it doesn't get propagated into Godot when i hit run. does any1 know: 1 how i might go about fixing it if this is already meant to do that. and 2 if this tutorial cant be used to do that, do people have any resources to learn how to do that.
This is good, although in the current version at least it looks like OmniSharp/language server doesn't work for the Godot SDK classes i.e. you won't be able to do "Go to Definition" on classes or types such as Vector2 or Sprite2D. Unless I messed something up with installation that is... I came here hoping to find a fix after hunting around and following less than ideal advice to use older extension versions which then caused SDK version issues which didn't resolve the issue anyway after fixing that too.
I'll report back if I'm ever able to get this working.
Run Godot run! This world is not made for you
Run Godot run! They're trying to catch you
Run Godot run! Running is a victory
Run Godot run! Beauty lays behind the hills
When he said "Run Godot" I couldn't stop hearing Woodkid lol
Haha, I thought of Forrest Gump, but I recognized the lyrics right away. :)
I want to come over from unity but having a hard time giving up c#. I have heard it is limited in godot. Learning another language to the three I already have is a limited option.
not sure what I am doing but VS2022 doesn't have that side bar on the left for me. I just open to a list of projects I have worked in.
Do you have a video how to setup auto completion for Visual Code?
For some reason even after selecting the main scene I get "The target process exited without raising a CoreCLR started event." error. Anyone know why?
Edit: Also worth mentioning it runs ok from the Godot editor.
Edit2: If anyone else runs into this problem try clicking on Run -> Run without debugging (or CTRL + f5). It might give you a better error message. In my case it showed me that I had a typo in my "${workspaceRoot}" arg.
i think i need to start godot
I like videos of L33T length
I just hope they fix the upstreaming issue with dotnet 7, so I can export to mobile and web soon lol
BTW, why is Camtasia Studio the king of screen recording and vid editing for youtube?
Is that good?
13:37 LOL!
10:05 For some reason, there is no breakpoint for me. It actually runs normally. Can someone tell me why?
same
When is Godot support for C# 12 and .NET 8 coming?
Did you make your video 13:37 on purpose? If so, well played.
Hello,
did you try to make hot reload working with vs code ?
i was able to make it works on visual studio 2022 (debugger + hot reload), butnot on vs code?
No, I did not. (not that I could/couldn't, I didn't attempt it).
Truth told, I've been burned enough by it, in several engines, I very rarely hot reload.
I did not find .net runtime install tool Just found .Net install tool Will this come on running?
nope and same
You saw it coming, huh :D ?
hey it showing me an error "failed to create c# solution"
Nice tutorial! However, my project was set to Exclusive Fullscreen. As I follow the video, once i push the debug button, the window covered my whole screen. And i cant return to code or desktop, with any keys pressed inavailable except ctrl+alt+del. What can i do? (CRAZY!!!)
I assume you tried windows key and selecting another program from the bar?
Make a video on how to use visual studio/vscode and Godot using C++
Godot is mostly GDScript and C#
I don't think you can use C++ within godot, it's just for extending the engine itself
Honestly after looking at this I'm just sticking to visual studio. It just worked without all this.
but how do you do it with the Node3D and not 2D?
Are there still limitations, if so what?
How do i use ocaml on Godot?
Thanks for sharing:) Are VS/C# free commercially? I would love to use C# but am I scared someone might try to charge me per install down the road😂
Visual Studio Code is free commercially. Visual Studio Community is free to use up to $1M revenue with certain size limits on company size.
Almost none of the .net setup in vscode is the same as what im seeing in the video.
When create a default task i dont get any dotnet options, i get create from template, Grunt, Gulp or Jake. If i select from template i get msbuild, Maven, .NET Core and Others. If i select .net Core my json file looks quite a bit different than yours.
Same issue with the launch task. I get same options but my "configureations" array is completely empty.
I had this issue, solved by going to the command palette & selecting .NET: Sign into visual studio account.
is this for 1 time or i am going to do this every single new project
Nothing happens when i press the debug button. Can someone help?
I have a problem in my code. When I create a C# script I cant write certain things. For example, when I delete the method: public override void _Ready() and try to rewrite it, I can't type in _Ready. It gets deleted as soon as I type in the first (. Even with shortcuts, when I press enter to autocomplete the word, it gets deleted too. Can anyone help?
Same here
@@definitelynotnick2454 please tell me if you figure it out. I spent so much time researching, but havent found a problem similar to that
@@definitelynotnick2454 Idk why it works now, but try to play around with the C# extension settings. I enabled omnisharp: enable async completion & Enable editor config support.
Hope that helps:)
So many people say try godot!
is there anyway to use the normal visual studio? i much prefer that over VScode
Change what it loads in the Godot Editor options - near the start of the video. VS and VS Code are very interchangeable as VS Code is just a stripped down version of VS.
Why do I get an error in VS Code saying "Could not find the task 'build'. I have the build tasks (tasks.json). I mean it's not a huge deal, I can go to godot and run it and it's fine. My code runs just fine, no issues. I just can't launch godot. The launch.json file is all accurate as well. I don't understand! lol
You most likely had the same problem as i had. He changes the tasks.json file after editing the launch.json file again... You need to replace "label": "dotnet: build" with "label": "build". Worked for me after i did that.
Jesus, after watching this maybe I am too stupid to learn this stuff.
But Godot 4 don't support C# export for android now, this is a big problem
Regarding C# limitations,
Basically if you use C# you can't make Android, Apple or Web games. Just PC games. That's the simple version I think.
I am not a Game dev neither a C# dev, I was curious so I checked their website & found some info.
"Property stopEntry is not allowed."
"Unrecognized problem matcher. Is the extension that contributes this problem matcher installed?"
you can just right click open in code in file explorer no need to cmd.
That's an optional extension actually.
Yes, that is possible also. You can right click and open in Visual Studio Code - that makes it easier
@@gamefromscratch don't think so I think you just select it during installation
Does C# in godot have any advantages over GDscript?
net libraries could work, interop should work. You can still use gdscript and c# together in the same project.
Only if you are already familiar with C# and don't want to learn a new language. If you don't know either, you're better off learning and using GDscript. Most of the tutorials you find will be in GDscript
c# is better and easier to learn and use.
C# is 10 times faster than gdscript
According to Godot's own documentation, C# is 4x faster than GDScript. However, it's worth noting that Godot 4 still does not support project importation for Android/IOS.
Anyone else having troubles finding the .NET runtime install tool?
why are we in a rush??
First.
this should work in linux right?
Yes
Unfortunately the c# dev kit constantly says it can’t find dotnet on Mac, no matter how many reinstalls or path changes. Rider launches right up and works perfectly though
Yeah same for me I do not get the luxury of using Rider
I think I've run into this issue as well as the program parameter in the launch.json file not recognizing the path provided to godot
@@Diabeticode I think that’s because the godot c# plugin isn’t updated for 4
A lot of angry Unity people gonna be headed this way.
Using VS/VSC over Rider? 🤮
visual ocde is busted... nothing is the same.
How? I just followed this with Godot 4.2.2 mono and it worked fine. Everything was the exact same.
Why should i do this?
I want to code.
Not to find out what i have to do to bring my IDE´s to run before i can code.
Linusian Nonsense
Such is the cost of hooking up two pieces of software. It's always been this way, in fact, the integrations are better now then they ever have been.
Also, you don't have to, you can code entirely in Godot if you want to. Hell, you can edit in Notepad if you really want to.
But if you want to take advantage of your IDEs tooling, you've gotta jump through some hoops.
Javascript developers, flutter developers all use VS code and setup their IDE before coding
Sick and tired of Microsoft and their account BS. Won't be using it.
This is exactly why I hate open source software. Instead one click on exe you spend 6 hours to make something work.
it's like 20 minutes.
What's the h**l???? Why do you not use Ubuntu or Mind? Please stop making more populur! You have enough explanations . It is not "Game from Scratch" just "Development from scratch" 🤔
wat
@Aeroxima Because He shows coding that's why he should to create "development from scratch" or "Coding from scratch" for writing and compiling
@@AeroximaI think this guy's just an attention-seeker. Just ignore him.
Can we use real Visual Studio with Godot?
Sure, tho idk why you would. It's a bloated hot mess.
@@King-mj2bn I`m just use to it because of Unity, never used VS Code.