C# Opening Problems

I don’t have much experience with Unity or coding and I decided today I would watch some of the tutorials and YouTube videos on how to use it. I got some of the basics down, and after taking a little break I went back on and it wouldn’t let me open my player controlling script. The script was just a couple of if else statements and translations so I deleted it and made a new script and it still wouldn’t let me open the script editor. I even reinstalled Unity and it still doesn’t work. Does anyone know what I can do to fix it?

You could try to make sure the External (code) editor is set properly. This should be the case when you get it, though. I usually open Unity first, then double click a script to open it inside my IDE (visual studio).

Do you have visual studio + visual studio tools for unity installed, as well?
That’s not the only setup that works, and also depends on the version of Unity… but it’s a good combo, imo.

1 Like

If you can’t get Unity’s built-in editor (Monodevelop, I think?) to function properly, you can always just edit code files with something else. You can find where Unity stores them for a project by right-clicking an asset and opening it in the File Explorer, and then you can edit your code with Notepad++ or whatever other editor you know functions properly.

This is how I do most of my Unity work, because I don’t really like Monodevelop (find it buggy and unnecessarily heavyweight, & it seemed to be a huge pain to get it to play nice with git). You can either create your files initially in the Unity UI or in the Assets subfolder of your project; in the latter case, it’ll be auto-detected when you tab back into Unity.

(The biggest downside to this is you’d have to shop around quite a bit if you want niceties in your Editor like C# auto-completion and the like. Features like that are one of Monodev’s strong points. I personally prefer a low-tech editing environment where I just memorize and google all of the classes and method calls I regularly use, though…)

I don’t have Visual Studio and Visual Studio Tools how do I get it?

Download the free Community edition from this link. As methos5k mentioned above, select the Unity component during the installation (you can always select it for install later if you initially forget). It is a very powerful IDE and the integrated debugger is a very useful tool to become familiar with as well. :slight_smile:

1 Like