Is it possible to navigate to assemblies definitions inside Visual Studio Code - unity3d

I'm using VS Code several days as MonoDevelop replacement in Unity3D on Mac OS. I installed mono via homebrew as suggested to let VS Code to parse system assemblies. Everything works almost great, but I can't navigate definitions that are not part of my code. For example I can't go to definition of System.String or UnityEngine.Vector3 to see methods signatures. MonoDevelop has Assembly browser but I miss it in VS Code. Does anybody know if VS Code has such feature? Maybe I need to setup something for that?
PS: I've posted feature request. If you're interested in this feature vote for it, please.
https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/14698887-implement-net-assembly-browser

It seems VS Code now can do that with the new extension ms-vscode for C# support. Previously it was recommended to use Legacy C# Support for Unity3D. I don't know exactly if this recommendation is still valid, but I tried to uninstall legacy and to install normal one. After some background work OmniSharp parsed my files and now it can open classes from assemblies! Look at this picture, it has open AnimationCurve class as [metadata]!
I'm trying it with Unity3D 5.5.0b2 beta now, so I'm not sure if this will work with production release of Unity3D. By the way I also removed VSCode plugin from dotBunny out of project as Unity3D 5.5 supports Visual Studio Code self.

Related

Can I create VS Code extensions in Python/C++?

I am totally new to creating extensions in VS Code, and all the official examples of extensions are written in Typescript/Javascript, which I have no experience with. Is it possible to create VS Code extensions in other languages, such as Python or C++?
If so, could anyone point me to any resources to get me started?
It is possible by creating a C++ module for Node.js, which can then be loaded like any other node module. Of course, some glue code written in JS or TS is necessary to register the extension and translate calls to/from vscode.
I've gone this way in my ANTLR4 extension, but gave up eventually, because of the troubles I had due to incompatible dependencies (you have to make sure the extension uses the exact same V8 version, which was used to build the underlying Node.js used by vscode, on all supported platforms).
This situation might have change, I don't know, but with that in the background I don't recommend it.
If you want to add support for a new language in vscode you can also write a separate language server, as is mentioned in the linked SO answer. For other type of work, I'm afraid, you have no alternative to use.
No, as #rioV8 said, since VSCode is an electron app and runs on Javascript.

TypeLoadException after loading .NET 4.5 C# DLL into Unity 2018.2.5

I want to be able to feed the camera frames from a webcam into Unity. I made a .NET 4.5 C# DLL using MediaFrameReader and event listeners. Here is some other user's implementation for accessing the Hololens camera frames: Hololens - Access Camera Frames.
When I import the DLL into my 2018.2.5 Unity project, it gives me the following error:
Unloading broken assembly "....", this assembly can cause crashes in the runtime
TypeLoadException: Could not find method due to a type load error
The C# plugin built successfully many times on Visual Studio. Also, I have properly set the Api Compatibility Level (in player settings) to .NET 4.x. What could be the fix to this?
All the other SO answers related to this I have already taken a look, but does not seem to help the problem. Thanks for all the help.
EDIT: https://issuetracker.unity3d.com/issues/unity-fails-to-load-net-4-dot-6-assemblies-with-typeloadexception is the most relatable post, but had no solution.
I have few possible solutions for you to explore.
DLLs issues:
Workaround:
Comment your UWP code (the part that uses the DLL), then build it in UNITY without the DLL. In the generated UWP solution, install the package from nuget or manually import the dll, then uncomment your code and finish your development. This is a short-term solution.It is going to be annoying as you re-build your solution many times and have to comment/uncomment then re-add dlls and so on.
Other possible solutions:
Failed to run reference rewriter with command error with unity error when adding a DLL to the assets folder
Your exact need
From your description, you really do not need everything in the link you referenced (Hololens - Access Camera Frames). You need much simpler version. I recently created MediaCapture solution for HoloLens as a workaround because PhotoCapture in Unity is not working in the HoloLens and everything is working without any additional DLLs. I will post for you few links to see if it may help you:
MediaCapture Unity & HoloLens: https://github.com/MSAlshair/HoloLensMediaCapture
This maybe a good start for you. You can combine it with your original reference. Use this project as starting point to make sure your project is building correct, then use the necessary code from the other resource that you posted to accomplish the task that you desire. You may need to download Unity 2018.2.12f1 because I didn't test it in 2018.2.5
MediaCapture & PhotoCapture: Hololens font camera
Good Luck!

Can F# be used with Unity (game engine)?

I'm getting into Unity, and wondering if I can use F# instead of C#, simply because I prefer the syntax. I'm guessing not, since the environment it runs on is very different, but maybe there's something that will cross-compile code or something else I'm not thinking of.
I can't help but get the impression that the other answers were written by people who do not really know what they are talking about.
This is what you need to do to use F# in a Unity project:
Create an F# project that compiles into a dll. Have it build into the assets folder of a Unity project.
Add references to UnityEngine.dll and/or UnityEditor.dll. Change the reference properties so the dlls aren't copied to the build folder.
Of course you can't create new F# classes from within the Unity editor this way, but you can assign the ones you wrote in F#.
Currently you need to enable the (experimental) support for .NET-version 4.5. Alternatively you can download an older version of the FSharp.Core.dll that supports .NET 3.5. (see here).
I can't guarantee that you won't run into trouble because of compatibility issues with the FSharp.Core.dll, but that's just a guess since I haven't tested it myself.
I had success doing this sometime back by following this Github project: https://github.com/eriksvedang/FSharp-Unity, which I believe is roughly the same as Lars Kokemohr's answer above. I haven't tested it in more recent versions of Unity/Mono however.
Yes you can use F# as first class language as C# in unity.
Here is an article about it link
an excellent blog for One who want to use F# in unity
if you want to use F# as second class which I recommend.
let me show how to do it.
Usually what I do is to create Game Domain in F# in .net standard
2.0 library project build it.
Make unity API Compatibility level .net standard 2.0 then
Import library project dll in asset/plugins in Unity
Here is an explanation on how to do it automatically after each build : link
You will get this error, here is the solution
Having said that I recommend not to do any serious work in unity with F# because you won't be able to cross compile to other platforms.
Unity uses IL2cpp and it don't work with F#.
In simple words unity don't support F# and if you are having issues like bugs in Il2cpp unity will not fix it because they don't support F#
There is no easy way to do this but if you REALLY want to make it happen I believe you could use something like fs2cs:
https://github.com/hsharpsoftware/fs2cs
In theory you could write a script that calls fs2cs on all of your Unity C# files. Integrating this with Unity itself would be the more challenging part, but in theory you can trigger fs2cs transpilation on save of your file and Unity can use the transpiled C# file.
Only Boo, C#, and UnityScript are officially supported!

MonoGame content builder

Is it possible to build content for MonoGame 3.0 without having to install Visual Studio 2010 and XNA 4.0?
The content I have to build is:
3D models
textures
sprite fonts
I am aware that there exists MGCB, but before I try and use it I need to know if it is reasonably reliable for what I need it to do.
I'm no expert in this area, but I noticed you don't have an answer yet so I'll try my best.
Having Visual Studio and XNA Game Studio 4.0 installed will allow you to create Content projects that can compile your content into XNB files. Those XNB files can be used in your game without Visual Studio. You can use Xamarin Studio instead.
However, it's also possible to use some content directly. For example, you can use raw PNG files instead of compiled textures and you can build your own system for fonts. I'm not sure about 3D models.
I can't vouch for MGCB but I've read that the MonoGame team are currently developing the content pipeline. If it's not working now it probably will be in the not so distant future.
So yes, it's probably possible.
Just some helpful links. I don't know if the MGCB is finished or completed. I say that because i though i saw a todo list some where on their Git repo. I could be wrong about that.
https://github.com/mono/MonoGame/wiki/Tutorials:-Installing-Prerequisites-on-Windows
http://www.monogame.net/documentation/?page=MGCB
docs on git say build from source
https://github.com/mono/MonoGame/wiki/MonoGame-Content-Processing#building-monogamecontentpipelineprocessors
Video shows how to build MGCB from source.
http://youtu.be/ultZwdGizqM?t=5m57s

Problems with IronPython Studio and PictureBox

Right, so I'm having a go at Iron Python Studio as I'm quite familiar with VS2005 and want to try Python with an integrated GUI designer. But as soon as I add a PictureBox I'm in trouble. When running the project I get complaints about BeginInit and soon enough the form designer stops working.
Is this because I'm running .NET 3.5 or some other compatibility issue? Couldn't find anything at the Iron Python Studio site
I'm having the same problem. What you can do is manually remove the BeginInit() and EndInit() calls, it should work fine then.
Have you checked out IronPython Blog on MSDN? You could probably drill down from there and find a definitive answer. If you do, be sure you update your question here!