Giter Site home page Giter Site logo

vscode's Introduction

VSCode

Seamless Visual Studio Code Integration in Unity - As seen in the Visual Studio Code documentation!

Requirements

Unity > 4.5 && Unity < 5.5

I am not sure exactly where in the 4.x cycle some of the features I'm using were introduced, but I'm guessing its around the 4.5+ mark. I've checked with the latest 4.5.0f6 release. Unity has also committed to having full support for Code when Unity 5.5 drops. So at that point all bets are off for the usefulness of this plugin. Like our MonoDevelop.Unity plugin of past, Unity catches up eventually.

Visual Studio Code 0.10.1+

Get the latest version, or have a look at the past releases of the VSCode plugin for support for your version.

Mono

A good number of people have needed to install Mono in order for many of the issues with OmniSharp to be resolved. I would suggest installing the latest package available at the Mono Project. Don't worry it will not mess with Unity.

Installation

It is important to make sure that the VSCode.cs file is placed under an Editor folder in the project. An example of this arrangement would be placing the file in /Assets/Plugins/Editor/VSCode.cs. By default it has its own folder structure which does this for you.

Unity Asset Store Package

A UAS packaged version of the plugin is available for your consumption.

Usage

Once the VSCode file is in place, simply navigate your way to the Unity Preferences and select VSCode and check the Enable Integration option.

That's it! You're ready to go!

OK, so maybe some people need a little video explaining some of the finer details of how to use the plugin. So I shot a quick video that highlights the ups and the downs (like Unity hanging after debugging sometimes) for people to watch. Please note this video is from a previous version of the plugin where things are in the menu, this has changed since then.

Platform Support

I use the plugin every day on a Mac (so it's battle tested there), and occasionally test it on a Windows VM. As for the recently announced Linux support, it should work just like the Mac version. I'll get around to installing the Linux editor sometime in the near future.

The Windows version of Visual Studio Code currently does not support debugging Mono, and will just throw a warning if you try to do it. The "Code" team is aware of this limitation, and we'll leave it at that.

Automatic Update

With version 2.0 of the plugin, I've introduced a feature where it will auto-update itself if allowed. This should make things a lot easier in the future.

Support

Please provide feedback through the GitHub Issue system.

vscode's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode's Issues

Debugger won't attach

Tried various settings in the launch.json files. Can't get it do attach or hit any breakpoints.

Unity Editor debug launcher is removed when installing this from asset store

When using the Debugger for Unity and installing this script from the unity asset store then the launcher config:

{
    "version":"0.1.0",
    "configurations":[
        {
            "name":"Unity Editor",
            "type": "unity",
            "request": "launch",
        }
    ]
}

get replaced with

{
    "version":"0.2.0",
    "configurations":[ 
        {
            "name":"Unity",
            "type":"mono",
            "request":"attach",
            "address":"localhost",
            "port":6068
        }
    ]
}

which means debugging unity doesn't work with Windows.

The work around is to manually overwrite the launch config back to the Debugger for Unity launch config.

Code colorization

Hello,

This is not an issue but I was wondering if there is a way for the syntax highlighting to color class names specifically?

Thanks!

"Open C# Project In Code" Removal

There are patches in the works from Unity to fix the annoying MD popping despite the settings.
Once those are out in the wild, I will get rid of this option.

Syntax highlighting

Is it possible to enable the Unity syntax highlighting and the preprocessor directives?

Update PDF File

Bring the help file to current version (particularly the art work and definitions)

Linux Support

This is more of a reminder to create the required features for linux support, which should have mono debugging! yay!

namespace UnityEngine not found

VSCode can't seem to find any of the Unity references. When opening VSCode I get the warning message "Some projects have trouble loading. Please review the output for more details."

In the output:

[WARNING:OmniSharp.MSBuild.MSBuildProjectSystem] The primary reference "System.Core",
which is a framework assembly, could not be resolved in the currently targeted framework.
".NETFramework,Version=v2.0". To resolve this problem, either remove the reference
"System.Core" or retarget your application to a framework version which contains
"System.Core".

[WARNING:OmniSharp.MSBuild.MSBuildProjectSystem] The primary reference "UnityEngine" could
not be resolved because it has an indirect dependency on the framework assembly
"System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which
could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0".
To resolve this problem, either remove the reference "UnityEngine" or retarget your
application to a framework version which contains "System.Core, Version=3.5.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089".
...
...

There's red squiggly underlines everywhere saying things like UnityEngine not found

System: Windows 7 Pro
Unity version: 5.3.1f1
Unity VSCode plugin version: 2.20-RELEASE
VSCode version: 0.10.6

debugging broken by latest vs code update

The latest vs code update has broken debugging, but modifying line 815 of the vscode.cs file seems to fix it:

string fileContent = "{\n\t\"version\":\"0.2.0\",\n\t\"configurations\":[ \n\t\t{\n\t\t\t\"name\":\"Unity\",\n\t\t\t\"type\":\"mono\",\n\t\t\t\"request\":\"attach\",\n\t\t\t\"address\":\"localhost\",\n\t\t\t\"port\":" + port + "\n\t\t}\n\t]\n}";

Basically, the version number is updated and request:attach is added.

PS, extensions functionality is now available in vs code.

No Intellisense

Help me please, I think it has to do with CRX files and android extension namespace or omnisharpor something.
[WARNING:OmniSharp.MSBuild.MSBuildProjectSystem] The primary reference "UnityEditor.Android.Extensions" could not be resolved because it has an indirect dependency on the framework assembly "System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "UnityEditor.Android.Extensions" or retarget your application to a framework version which contains "System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".

Not Displaying VsCode Window in Preferences

I've been trying to get this plugin working with Unity 5.2 so that I can use Code properly with intellisense and the other features that are specific to code. I have tried redownloading the plugin, using the unity store version and the github version and it never shows up in the unity preferences window. This is my folder structure:
screen shot 2015-11-25 at 8 49 38 pm

Edit: I am running version 5.2.3f of Unity, the latest version of mono and 0.10 of Code

Cannot start Omnisharp. Wrong Mono Version.

[ERROR] Error: Cannot start Omnisharp because Mono version >=4.0.1 is required. See http://go.microsoft.com/fwlink/?linkID=534832#_20001

The latest mono version is installed /Library/Frameworks/.

New Class Not Being Detected By VSCode?

Just created a new C# class in Unity through the editor. VSCode hasn't picked it up yet. I've tried restarting both applications, enabling and disabling integration, force syncing the project, opening the project through the VSCode menu... no luck.

The class is quite simple - just a MonoBehavior that uses the UnityEngine and has a bunch of tweakables in it.

using UnityEngine;

public class HUDConfig : MonoBehaviour {

    [Header("HUD Configuration")]
    public Vector3 pulseTargetScale = Vector3.one;
    public float pulseScaleTime = 1.0f;
    public iTween.EaseType pulseScaleEaseType = iTween.EaseType.easeInSine;
    public float pulseInterDelayMax = 1.25f;
    public float pulseInterDelayMin = 0.4f;
    public Vector3 pulseShakeMax = Vector3.one;
    public Vector3 pulseShakeMin = Vector3.zero;
    public GameObject streakContainerPrefab = null;
    public int fastestPulseAtStreak = 75;
}

Update Unity Asset store version

The code that is available on the Unity Asset Store was last updated in October. There's several things that can are fixed since then such as #57

VSCode OmniSharp Startup Errors

I've got a lot of Asset Store assets stored under my project's "Standard Assets" directory. (to speed up compiles)

When VSCode fires up OmniSharp I get a pile of errors like the following because evidently OmniSharp isn't looking inside the "Standard Assets" directory for code:

[ERROR:OmniSharp.MSBuild.MSBuildProjectSystem] The type or namespace name `TextMeshPro' could not be found. Are you missing an assembly reference?

Assuming this is a bug, but please forgive if not. Any ideas how to fix?

Link to Open C# Project

Piggy back on the Open C# Project menu item, allowing for the removal of the VSCode menu entirely.

Open C# Project in Code also open Visual Studio 2013

I understand that this might not happen on OSX (for obvious reason), but on Windows, with Visual Studio 2013/2010 installed. Every time I click on the menu entry, it opens Visual Studio 2013 and VSCode. Previously when MonoDevelop is installed, it would start MonoDevelop. Is this supposed to be this way (VSCode require one of these IDE to also open)? I already install Unity without MonoDevelop and uninstall the Microsoft Visual Studio Tools for Unity. I also tried resetting the preference, but it appears that Unity automatically detect if Visual Studio is installed on the system.

Unset VSCode On Editor Quit

Have the ability to revert to previous settings when leaving the editor, so that the overrides do not persist between projects.

An odd request, but I see purpose in this.

Can't Start OmniSharp

Looks like OmniSharp can't start, so many features aren't working? My log:

[INFO] Starting OmniSharp at '/Users/mathe015/Repositories/MatchThreeMoji/MatchThreeMoji-csharp.sln'...
[INFO] Started OmniSharp from '/Applications/Visual Studio Code.app/Contents/Resources/app/plugins/vs.language.csharp.o/bin/omnisharp' with process id 77938...
Can't find custom attr constructor image: /Applications/Visual Studio Code.app/Contents/Resources/app/plugins/vs.language.csharp.o/bin/approot/packages/Microsoft.AspNet.Cryptography.Internal/1.0.0-beta4/lib/dnx451/Microsoft.AspNet.Cryptography.Internal.dll mtoken: 0x0a000004
* Assertion at class.c:5695, condition `!mono_loader_get_last_error ()' not met
Stacktrace:

  at <unknown> <0xffffffff>
  at Microsoft.Framework.DependencyInjection.DataProtectionServices/<GetDefaultServices>d__0.MoveNext () <0x0021b>
  at Microsoft.Framework.DependencyInjection.ServiceCollectionExtensions.TryAdd (Microsoft.Framework.DependencyInjection.IServiceCollection,System.Collections.Generic.IEnumerable`1<Microsoft.Framework.DependencyInjection.ServiceDescriptor>) <0x00064>
  at Microsoft.Framework.DependencyInjection.DataProtectionServiceCollectionExtensions.AddDataProtection (Microsoft.Framework.DependencyInjection.IServiceCollection) <0x0002b>
  at Microsoft.Framework.DependencyInjection.MvcServiceCollectionExtensions.ConfigureDefaultServices (Microsoft.Framework.DependencyInjection.IServiceCollection) <0x0001b>
  at Microsoft.Framework.DependencyInjection.MvcServiceCollectionExtensions.AddMvc (Microsoft.Framework.DependencyInjection.IServiceCollection) <0x00013>
  at OmniSharp.Startup.ConfigureServices (Microsoft.Framework.DependencyInjection.IServiceCollection) <0x0003f>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0xffffffff>
* Assertion at class.c:5695, condition `!mono_loader_get_last_error ()' not met

OmniSharp not working

Hi.

the flame icon is not showing up at all. OmniSharp features are not working. I read everything I could find.

My Setup:

Regarding VSCode.cs file:

  • VSCode.cs file is in Assets/Plugins/VSCode/Editor
  • VS Code > "Enable Integration" is enabled
  • I tried all combinations of Force Sync Project, Open Project and Write Launch File
  • It opens the correct files and lines of code!
  • I can't find a launch.json file anywhere!

Any idea?

Plugin downloadable with unity below 5.2 form asset store.

I think the asset store only lets you download assets when you use unity versions that are equal or higher than the one you submitted the asset to the store with.
Since the asset was submitted using 5.2, anyone with a lower version can't download it.

I would be great if you can resubmit the asset with unity 4.6, so anyone with a version higher than that can get the asset from the store.

Thanks!

Windows Support

After testing VSCode 0.7.x on Windows, I've found that my VSCode doesn't like the idea of debugging "mono".

Reached out to the VS Code team for some direction.

Overloaded methods not supported in the expression evaluation of the debugger

When debugging in VSCode while attached to Unity, attempting to invoke an overloaded method on an instance of a derived class will instead invoke the method on the parent class. During normal execution the correct method gets called.
Note that this only occurs if the scoped instance is referenced by the parent type, rather than by the derived type.

public class Foo
{
public virtual string getString() { return "foo"; }
}

public class Bar : Foo
{
override public string getString() { return "bar"; }
}

public class Example
{
Bar bar1 = new Bar();
Foo bar2 = new Bar();
}

While debugging:

bar1.getString()
"bar"
bar2.getString()
"foo"
((Bar)bar2).getString()
"bar"

This may not be the fault of the plugin! However, it seems likely, as a similar fix had to be made to the now-obsolete UnityVS library: http://unityvs.com/documentation/changelog/

Unity Code Editor Not Updated

It seems at times the editor set by preference to open a project isn't being respected (shown in preferences) ... takes a few times of settigns before it does?

This could resolve the open with c# project if i fix that

Missing assembly references

Hi! I'm getting a lot of ...

"[ERROR:OmniSharp.MSBuild.MSBuildProjectSystem] The type or namespace name `SomeClass' could not be found. Are you missing an assembly reference?"

Did I do something stupid or are the project files not properly set up for VSCode?

Edit: These are third party assemblies btw.

Omnisharp fails to load Editor-vs.csproj (on multiple unrelated projects)

[WARNING:OmniSharp.MSBuild.MSBuildProjectSystem] Failed to process project file '/Users/xyz/project/Assembly-CSharp-Editor-vs.csproj'.
/Users/xyz/project/Assembly-CSharp-Editor-vs.csproj

thought it might be project specific but now see it twice on 2 computers on different unity versions (4.6 vs 5.3), and 2 totally different projects from totally different companies.

What gives? How do i debug? there's no other issues related to that csproj listed in the output.

Create an asset package for the addon

To ease install, it should be possible to install the addon though an asset package.
It's easy enough to create and then can be either hosted as a download / release on the GitHub page or uploaded to the asset store.

-CSharp.sln file is not generated

Hello friends! I'm trying to use the VSCo desperately, but I could not make it work! My problem this time is that the -CSharp.sln file is not generated by Unity! Could anyone help me with this?
captura de tela 2015-11-09 as 10 08 12

OmniSharp can't parse Assembly-CSharp-Editor.

I tried mono and dnx from homebrew and as standalone installers from their websites. After opening solution VS Code produces the following log:

[INFO] Starting OmniSharp at '/Users/dmitry/projects/fiftytwo/OneHandGame/OneHandGame.sln'...
[INFO] Started OmniSharp from '/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/csharp-o/bin/omnisharp' with process id 77639...
[INFORMATION:OmniSharp.Startup] Omnisharp server running using stdio at location '/Users/dmitry/projects/fiftytwo/OneHandGame' on host 77282.
[INFORMATION:OmniSharp.Dnx.DnxPaths] Using runtime '/Users/dmitry/.dnx/runtimes/dnx-mono.1.0.0-rc2-16249'.
[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Scanning '/Users/dmitry/projects/fiftytwo/OneHandGame' for DNX projects
[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] No project.json based projects found
[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] Detecting projects in '/Users/dmitry/projects/fiftytwo/OneHandGame/OneHandGame.sln'.
[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] Loading project from '/Users/dmitry/projects/fiftytwo/OneHandGame/Assembly-CSharp-firstpass.csproj'.
[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] Loading project from '/Users/dmitry/projects/fiftytwo/OneHandGame/Assembly-CSharp.csproj'.
[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] Loading project from '/Users/dmitry/projects/fiftytwo/OneHandGame/Assembly-CSharp-Editor-firstpass.csproj'.
[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] Loading project from '/Users/dmitry/projects/fiftytwo/OneHandGame/Assembly-CSharp-Editor.csproj'.
[ERROR:OmniSharp.MSBuild.MSBuildProjectSystem] Unexpected symbol `1E-05', expecting `.' or `['
[ERROR:OmniSharp.MSBuild.MSBuildProjectSystem] Unexpected symbol `1E-05', expecting `.' or `['
[ERROR:OmniSharp.MSBuild.MSBuildProjectSystem] Unexpected symbol `1E-05', expecting `.' or `['
[ERROR:OmniSharp.MSBuild.MSBuildProjectSystem] Unexpected symbol `1E-05', expecting `.' or `['
[WARNING:OmniSharp.MSBuild.MSBuildProjectSystem] Failed to process project file '/Users/dmitry/projects/fiftytwo/OneHandGame/Assembly-CSharp-Editor.csproj'.
/Users/dmitry/projects/fiftytwo/OneHandGame/Assembly-CSharp-Editor.csproj

[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Detecting CSX files in '/Users/dmitry/projects/fiftytwo/OneHandGame'.
[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Could not find any CSX files
[INFORMATION:OmniSharp.Startup] Solution has finished loading

So, it can't load Assembly-CSharp-Editor.csproj, but it seems other projects loaded fine. Have you some ideas about it, what can be wrong? OmniSharp does not write a place of the unexpected symbol, so I have no idea where it is located. I tried to find 1E-05 in the file, but it does not present there. Maybe it is some code of character, I don't know...

PS: I created new test project that doesn't have the issue. So, it's project specific and appeared in large game project.

The specified runtime path 'default' does not exist.

OmniSharp has a few errors when opening my project, including:

[ERROR:OmniSharp.Dnx.DnxPaths] The specified runtime path 'default' does not exist. Searched locations /Users/david/.dnx/runtimes/dnx-mono.default
/Users/david/.dnx/runtimes/kre-mono.default
/Users/david/.dnx/packages/KRE-Mono.default
/Users/david/.k/runtimes/dnx-mono.default
/Users/david/.k/runtimes/kre-mono.default
/Users/david/.k/packages/KRE-Mono.default
/Users/david/.kre/runtimes/dnx-mono.default
/Users/david/.kre/runtimes/kre-mono.default
/Users/david/.kre/packages/KRE-Mono.default.

Togglable Writing Of Launch.json

Should add this as a feature where you dont always have to write out the launch.json ... so people can have multiple configs if they for some reason do :D

Can't find VSCode tab in preferences

I have installed the files, moved the "Plugins" folder with all its content into my unity project but can't find VSCode in the preferences. I really want VSCode to work with unity! Please help me!

launch.json resetting its content to default when Unity enters Playmode

I tried changing default Unity profile in "configurations" (by adding "request":"attach" line), adding custom profile, but every time I run project in Editor, launch.json resets to its default state.

Unity3D version: 5.2.1f1
OS: MacOS Yosemite 10.10.5.
VS Code version: 0.10.1 (issue was there before).

OmniSharp just says "Select Project"

Just upgraded to 0.9.0 and now when I have Enable Integration selected there is no intellisense and OmniSharp says "select project". What's up?

Win32 Exception

I did everything like indicated in MS site, I'm on 0.10.3, Unity 5.3.0 and your latest package. I'm also using Unity's debugger package, I get the exception when I open a file or the C# project.

Auto Script Update and Placement

Have a toggle option to automatically poll GitHub for the latest version and automatically update if need be.

The script should also automatically move itself into /Plugins/Editor/

Windows 10 cmd window doesn't close

When opened any script cmd window doesn't close.
I fix it by add this string

proc.StartInfo.CreateNoWindow = true;

after this code start on line 297

#elif UNITY_EDITOR_WIN
            proc.StartInfo.FileName = "code";
            proc.StartInfo.Arguments = args;
            proc.StartInfo.UseShellExecute = false;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.