• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS20 SimConnect + Unity for virtual sextant

Messages
3
Country
germany
Hey,

I‘m currently building a (bubble) sextant simulator in Unity. So far I got accurate simulation of stars and the sun and you can take sights of those from any location and time on Earth. In my first few tests it was accurate to the minute.

I planned this to be kind of a companion app to MSFS, so you have to run it simultaneously to the sim and it’s not directly integrated. I think it’s much simpler to get a sextant simulated in Unity, then in MSFS. However, I’m stuck in getting SimConnect into my unity project. I‘ve seen a post here and searched the MSFS forums, but I didn’t managed to make it work and it seems nobody has. Unity always says type or namespace FlightSimulator doesn’t exist in the namespace Microsoft.
I tried to add the DLLs manually, upgrade Unity to .NET 4, used VS to compile everything. Nothing works.

So for now I‘m using a SimConnect Wrapper I found on GitHub, which saves SimVars into a JSON. I then read the Json from Unity. This works great, but in the long run I would like to integrate simconnect directly, or at least only run a helper in background which gets the simvars for me. The wrapper I found comes with a lot of DLLs and files and I want to keep it simple once I publish it, and I don’t want users to start multiple apps or dealing with a lot of files.
I tried to merge the wrapper into one exe, but the build always fails - I’m not experienced developing for windows sadly.

I only need the local sim time, date and longitude, latitude of the player.

Has anybody any idea how I could get SimConnect to run in unity? Or what other options might be?

Thanks!
Ps: that’s the wrapper I’m using: https://github.com/smairo/Smairo.MSFS2020.SimConnector
 
Yes!
I was able to build the Json program with Visual Studio now, it’s runs as a separate app. so the setup is working, but would be much nicer to build simconnect directly into unity.
 
I thought Unity was a game engine... i.e. a graphics engine with an API so that it can be used inside another application. How are you compiling the program? What language are you using?

Also, a lot of people are asking how to do things with SimConnect in MSFS2020... well, the answer is: the same way it was done in FSX. The FSX SimConnect documentation and example projects are perfect sources for the answers of all the basics. The Prepar3D v3 SimConnect SDK can also provide a great deal of the same information, though there are some Prepar3D specific variances.
 
Last edited:
Yes unity is a game engine. But not like an API, it’s a standalone game engine. Code is written in C# and unity has its own compiler. You can also add assemblies or other third party code via .dll, but unity fails to compile the simconnect dlls. Might be that it doesn’t support the .NET framework version or something.
 
Let me chime in here. I tried to compile sample code straight out of the FSX SDK (yes, FSX) and get the same message. If I try to compile ANY CS script that has "using Microsoft.FlightSimulator.Simconnect", I get the same error. What is REALLY odd is that the CS plugin in NPP can read the dll and populate intellisense list.

1662315508061.png

But the compiler chokes:

1662315552171.png


A few hours later... just in case there are any other intrepid FSX warriors:
You have to include a reference to the actual dll. for CLI, I copied the SimConnect dll to my working directory to make it easier:

1662320513869.png


If you don't want to copy the dll, you can reference it in DAC:

C:\WINDOWS\assembly\GAC_32\Microsoft.FlightSimulator.SimConnect\10.0.61259.0__31bf3856ad364e35\Microsoft.FlightSimulator.SimConnect.dll
 
Last edited:
Back
Top