How Can I setup Visual Studio 2019 For Unigine Support?


photo

Recommended Posts

How Can I setup Visual Studio 2019 For Unigine Support? Whenever I try to edit my code in visual studio i dont find any suggestion or anything to help me with,that doesn't show any error ,or any classes, like it's blank, i cant code in any IDE,not visual studio not visual studio code, IDE doesn't catch any classes of unigine what to do?

Unigine.png

Link to post

Hello!

Well, it's not obvious but suggestions and highlights will not work with Visual Studio 2019 when you open "*.cs" component separately from the project because there is no support for that, only Visual Studio Code can run that case.

If you want to work with your project in Visual Studio you need to open solution (*.csproj or *.sln) file or just click on "Open Code IDE" at SDK browser. Thanks!

изображение.png

изображение.png

Link to post
  • 6 months later...
Posted (edited)

A little necro, but I'm new to Unigine and just went through figuring out approaches to set/configuration for Visual Studio. Sharing what I found.

 As bmyagkov said, the main thing is opening VS from the browser.

A couple of things I found helpful:

Study the .csproj file. It tells you a lot about what is going on. This seems to be the primary link-point between the engine and VS.

Make good use of Application arguments (Project->[ProjectName]Properties, Debug tab). Launching from VS and from the Editor can be a be a little different. Some tweaks here can make them closer (or more different depending on your needs) without hard coding some dev related things into your project.

I like to namespace everything. Unigine doesn't seem to care much about namespaces, so you can do whatever you want. If you have Resharper this gets real easy:  In VS right click on the "data" folder and select "edit project data properties". Set "namespace provider" to false. Do the same for the "data" folder. Now you can right click any file or folder (or the whole project) and select "Refactor-> Adjust Namespaces". This will namespace your classes under the project name, without including ".data." and ".source." in the namespace. (Always do this after you create components in the Editor - they are created in the root namespace) In some cases you may get name collisions on the engine side (usually in the properties: under node_base/C# Components/.   I think these names don't mean much and are mostly "reference labels". I usually just rename them prefixed by the namespace (replacing '.' with '_').

In Solution Explorer, "Show All Files" can be useful, especially early on.

In the Editor, two of your good friends are "Tools/Cleaner" and "Reimport" (especially for .world). You can think of these like "Clean and Rebuild" in VS. When things seem to get out of sync between VS and the Editor, cleaning and reimporting your world can make a lot of bugs go away.

Build in the Editor, run from VS. If I'm coding I rarely run from the Editor. In fact, you can close it if you want.

Use "using directives". I have "using static Unigine.Input; using static Unigine.MathLib;"  in lots of files. It makes the code cleaner and (usually) clearer. Aliases can be useful too. 

Hope this helps someone.

Edited by Tessalator
  • Like 1
Link to post