So I'm new to Unity and I'm watching a few tutorials to learn the basics. Something that got my attention is that in the videos they have an autocomplete and while I've got it too, it gives too few options. For instance it doesn't show the Debug or any of its properties. It runs fine but it's really annoying.
I don't know if it's related but it also lacks some coloration. Like in the videos Debug is colored orange but mine is not colored differently from the rest.
Not sure about your VS version and Unity version, but please update them if possible. For example, you have VS2017 15.8 and Unity 2018.1, then please update them to VS2017 15.9.17 and Unity2018.3.8 or higher.
And it seems to be one similar issue like this report in DC. You can find details from Sebastien Lebreton for trouble-shooting the issue there.
Make sure:
Visual Studio is set as your external script editor in Unity (Edit/Preferences/External Tools)
Visual Studio plugin is installed in Unity (Help/About must display a message like Microsoft Visual Studio Tools for Unity is enabled at the bottom).
Then check that the extension is properly installed in Visual Studio (Help/About).
You can try:
backup your project
quit both VS and Unity
remove all generated sln/csproj
remove the hidden .vs folder in VS Solution folder
remove the Library folder
re-open the project with Unity
In Unity, use Assets/Open C# Project to open that in Visual Studio
In addition to Lance Li-MSFT's answer I happened to observe this: When you create a new script (for example with "Add Component" -> "New Script") and then try to open it directly, this can happen. So after you created your script, give unity a few seconds to compile and then open it. For scripts that are opened to early, I did not manage to fix them. They just won't show IntelliSens hints, otherwise they work perfectly normal.
Just spent some time solving this
(VS 2022 community, Unity 2020.3.30f).
It happens that by defaut in Unity
Edit \ Preferences \ External tools
"External script editor" is set to "Open file by extension".
And script does open in VS 2022, and script compiles in Unity after editing, but it does not create .vs folder with all project related stuff.
So intellisence just did not kick in to Unity.
But after I set "External script editor" to Visual Studio, it started to work
(hints and coloration).
I need to open, edit, and debug an ASP.NET Core project in VS Code on a mac. The project was created in Visual Vtudio 2015 on a PC.
I'm having trouble. I get the error
No task runner configured
and it brings me to launch.json.
It sounds like a gulp thing and I'm not sure what I'd need gulp for... nor do I know what to do with launch.json, having come from visual studio 2015. Shouldn't it just launch in Kestral and go?
For some reason all the S/O questions and tutorials I've found through search are about creating a .Net Core project in VS Code and maybe opening it in Visual Studio... Not what I need. Other way around. Project created on PC in Visual Studio then open and fully develop on mac in VS Code.
Maybe my search query is wrong. Surely this isn't a new problem. Or, maybe I'm just doing something stupid.
When you click Launch. Then you select dot net core on launch json option. It would create a launch.json like this:
https://github.com/tuoitrevohoc/NetExpress/blob/master/.vscode/launch.json
Then you need to edit the path to your built dll file. And click run again. Follow the guide to create a task.json to build the project. Then when you click run again it will run.
I really like the idea of working with Visual Studio, C# and Unity on OS X.
Has anyone made debugging with C# in Unity work with Visual Studio Code on OS X?
Yes it works absolutely fine. Unity is C#, JavaScript or Boo. So, you don't need .NET for it. Unity uses Mono runtime. So, an existing VS project can be opened in Unity for Mac OS X.
EDIT
Here is a link that helps you to attach a debugger to the VS endpoint.
http://www.yunspace.com/2015/01/19/integrating-visualstudio-with-unity3d-on-mac-using-vstools/
You can try VS Tools for Unity too.
http://unityvs.com
UPDATE
There is this awesome Unity Plugin by dotBunny that solves the problem and integrates Code with Unity tools.
Hi the solution is https://github.com/dotBunny/VSCode This plugin works on both MacOS and Windows and gives you the following capabilities:
•An option to enable VS Code integration (Editor –> Assets –> Enable Integration), this updates your solution files and (more importantly) keeps them in sync. This also sets the preferred external tool editor in the Unity preferences.
*Note, the old “Sync MonoDevelop” option is now gone in the Unity editor from V5.2
•It writes out the necessary (and sometimes hard to find) VS Code configuration files, including the ability to hide “non-code” files in the editor (hides things like .sln, .csproj and the ever present unity .meta files)
There are a couple of other settings in there to help speed up the integration.
•Automatically launches VS Code direct to your project folder, EVERY-TIME. no longer do you have to worry about keeping that window open, or switching around if you work on multiple projects
One thing to be aware of, once you enable the VSCode integration, changing your preferred code editor in the External Tools preferences will have no effect as the plugin takes over opening code files. If you want to use another editor, you’ll have to disable the integration first.
These are just the main highlights as there are more features in there as well.
Currently you need to download the plugin files from GitHub
An existing Visual Studio solution can be build and debugged with Visual Studio Code on the Mac with Mono. You have to use the launch.json and tasks.json files.
I described it on my blog: Compile and Debug
To build Unity in Visual Studio Code, you can hook up Mono xbuild compiler as a task runner, so you don't even have to leave IDE to have errors and warnings.
See https://twitter.com/_eppz/status/846859856787259392 for more.
It's a little unstable. But it's possible from recent VSC version.
1) Install this VSC Unity plugin-in.
https://github.com/dotBunny/VSCode/
2) Follow these commands. (Step 1, 2 and 3)
https://code.visualstudio.com/Docs/runtimes/unity
3) After you complete the settings, launch the VSC using Unity menu.
Assets/Open C# Project in Code
4) Play the Unity project.
You can see the debug port number on the unity console.
And the project's launch.json file will be renewed automatically.
To open launch.json, click option icons.
the file exists in this folder.
.vscode/launch.json
sample.
{
"version":"0.1.0",
"configurations":[
{
"name":"Unity",
"type":"mono",
"address":"localhost",
"port":56621
}
]
}
5) Start debug in VSC debug tab.
That's it. Hope this help.
Update, 2016 - the petition was popular enough that some VS Code extensions have been written for it: https://marketplace.visualstudio.com/search?term=unity&target=VSCode&sortBy=Relevance
Petition for it on the Visual Studio UserVoice page: http://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/7752702-unity-integration
[Feb 2017] It is now possible to do this without the dotBunny plugin.
i.e. Support is built into Unity natively.
Just to repeat, you don't need to fiddle with Unity, just VSCode.
Instructions here
Instructions are incomplete though, and I didn't take screenshots (please do!), but basically what I did was:
(...and please improve these instructions as you go, I'm working from memory...)
I deleted/renamed my .vscode/Launch.json file, as per the link.
Double-click on some file to bring up the project in VSCode (maybe first make sure that in Unity's settings you have selected VSCode as your default code editor)
clicking the bug icon then the cogwheel, as per the link.
I had to install that vscode-unity-debug plugin in VSCode, just filtering the search with 'unity' found it.
I then had to press the green 'play' triangle.
I set a breakpoint in my code.
Now over to unity and press play, and the breakpoint gets hit.
The Unity Debugger for Visual Studio Code is working, but doesn't work well enough when doing any kind of serious work for now. I really hope they will improve it in the future as I prefer VS Code over VS.
Current problems I encountered
-Sometimes I cannot step in a function, the debugger will hang until you detach
-no local variable, you have to watch everything
-some more complex variable have no support, so you can't see what is inside
-A bit overall unstable with unexpected behaviours.
What I love about it,
Attaching & Detaching is a breeze. Just press a button, allowing to attach and detach quickly as needed. e.g. At the beginning of the program I work on, there will be an bunch of exception. I can detach and attach quickly to skip the exceptions.
The problems with it are too constraining as it currently stands, I had to go back to the classic Visual Studio.
I installed Microsoft Visual Studio and during installation i think i somehow ticked the Team Project checkbox. Now i'm unable to create a normal ASP.NET website in any way. I would be very grateful if someone tells how to fix this thing. Also i have uninstalled and installed seven times. But no luck. Thank you.
If I have understood You right. You try to change default templates in IDE for Web developers.
In Visual studio you can easily change the profile of the IDE by going to Tools -> Import Export Settings. This brings up Import Export Windows Wizard. Follow the simple Wizard (which also allows to save you the current settings for future use) and select the new profile setting (based on the kind of project you are working on) and you are ready to work with new profile.
I assume You need to choose "Web development".
In Visual Studio 2008, there was the device manager for setting up additional templates and options for the emulator. None of these options are available with Visual Studio 2010 which I understand as the features were removed.
When the Phone Tools are installed, the device target box comes back but there are no options at all.
Basically, I was just wondering where this list gets its options from and if there is any way at all to configure it?
The closest I got to was find the %LocalAppData%\microsoft\phone tools folder, but not sure this is correct as it appears to be more related to the emulator itself (e.g. if deleted, it gets recreated when you run.).
(Link to something a post that helped me years ago)
It took me a while, but it looks like I have found it.
I was on to the correct path with %LocalAppData%\microsoft\phone tools. All the targets are in the conman_ds_platform.xslt file.
I have no idea why they no longer provide an interface for customising - but it looks to me that despite MS taking the feature out of Visual Studio, it is still possible to customise this and add your own devices just fine.
... Next, depending on time, I will try to convert the Windows Mobile/CE project templates to VS 2010 and see if it is possible to do full development on Visual Studio 2010.