Considering Unity. Like it so far. Some questions about C#

So I really like coding in C#. I’m currently making a game in XNA and am thinking I might make my next game in unity.

I set up Visual Studio with the UnityEngine.dll as a reference. I got auto-complete working and all that.

Thing is I can’t get the script files in unity to update when I save in C#. I tried right clicking on the script file and selecting Sync Visual Studio Project. I also tried reimporting the script file.

Anyone have an idea of what I might be missing?

In your Edit>Preferences, do you have Visual Studio set up as your preferred editing environment (External Script Editor)?

-BSpline

Thats part of it :slight_smile: Thanks!

Now my script files open visual studio in scripting mode though and I’ve lost my autocomplete ect…

Is their a document somewhere on how to set this up?

Also Does anyone know when or if namespace support is planed. (my projects are going to be big enough that the lack of namespaces would make me sad.)

from experiments it seems like you can already use them. the former “error” that you got is only a warning anymore.

What do you mean by lost autocomplete etc? it should just work given the solution setup worked all fine. nothing to setup there :slight_smile:

also the script files should auto update the moment you switch back to unity (as long as you don’t they naturally also won’t do it)

Try using the Sync with Visual Studio option on the Assets Menu. It creates a project with everything you need to create your class within the VS.

I must be missing something.

So If I Manually create a project and add the dll as a reference then import the .cs files the auto complete and syntax highlighting works, but VS dosnt update Unity.

If I start unity create a .cs file and then double click it it creates a VS project for me with a New Unity Project. I can Sync with Visual studio and the code done in VS updates in the unity editor. However it says under The New Unity Project that the application is not supported, I cant add references to the dll under it and I have no autocomplete or syntex highlighting.

I use Visual Studio Express 2008

All you have to do is Assets → Sync With VS and a visual studio (MonoDevelop also) compatible project is created in your root project folder (not inside the Assets). If you open the project with VS (MD) and create your scripts inside the Assets folder, the problem should be solved.

The problem with the DLLs is probably because you´re not using Unity Pro and you can´t load DLLs using the free version. But you don´t need to load anything to get intelesense and codecomplete, Sync and create your files inside the Assets folder.

Thanks! It works. :slight_smile: