1

1) I set my preferences to open up Unity .cs files using Visual Studio 2012

2) I came across this: https://visualstudiogallery.msdn.microsoft.com/7ab11d2a-f413-4ed6-b3de-ff1d05157714

and I download and installed VS2012 Tools for Unity

3) Now I'm stuck here, when I try and run/debug a single .cs file in VS, I get this exception:

"A project with an Output Type of Class Library cannot be started directly. In order to debug this project,add an executable project to this solution which references the library project. Set the executable project as a startup project."

I'm not sure what that means and how to proceed. I'm not sure how to sync up Unity with Visual Studio.

Anyone?

Btw, I have Unity free version 4.6.1 installed and Visual Studio Premium 2012.

Thanks

3 Answers 3

2

http://unityvs.com/

Once you have installed the correct version for your VS version you need to open your unity project (in unity) and add the VS tools package ...

Assets > import package > Tools for unity 20xx

Then you need to set your default editor in ...

Edit > Preferences > External Tools

Then when you click on scripts in unity it should open them in VS.

Now from VS you should have the option to attach the unity debugger where it normally says "debug" in the toolbar.

After attaching your debugger to unity run your game by hitting play in unity and it should hit any breakpoints you have set in VS.

All should magically work.

Sign up to request clarification or add additional context in comments.

2 Comments

Sadly, can we chat? I did install that BUT I'm still having issues. I have no idea how to proceed. Can you help me? Please read full post.
Im in the game dev chat right now: chat.stackexchange.com/rooms/19/game-development
0

Close visual studio and Unity.

Download and install Tools for unity 2012 and links to other versions can be found here: https://visualstudiogallery.msdn.microsoft.com/7ab11d2a-f413-4ed6-b3de-ff1d05157714

Open Unity 3d

Then like Wardy said:

  1. Assets > import package, Select "Tools for unity 2012"
  2. Edit > Preferences > External Tools, select 2012

Comments

0

I had the same error massage using unity 2018 & visual Studio 2017. Frankly, closing VS and opening it after double clicking on a unity script (inside unity) solved it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.