Support for Unity Game Engine

15 posts / 0 new
Last post
Offline
Last seen: 5 years 2 months ago
Joined: 09/10/2014
Posts: 1
Support for Unity Game Engine

Hello my learned friends.

We are looking at implementing a simulation environment and need to communicate with the Unity Game Engine. So far I have found two products that look like they come close from VT Mäk but I cannot say with any degree of confidence they are what we are looking for.

Does anyone know of a suitable (preferably RTI based) product that will interface with Unity? Have any of you gone through this process already?
All advice is appreciated.

Cheers.

Organization:
gianpiero's picture
Offline
Last seen: 7 months 1 week ago
Joined: 06/02/2010
Posts: 174

Hi there,

I am not an expert on unity but I think unity uses C# (among other languages) as main language development.. right? Could you use our c# api?

-- Gianpiero

Offline
Last seen: 2 years 9 months ago
Joined: 01/25/2017
Posts: 2

Unfortunately since even the latest version of Unity, 5.5, is still based on .NET 3.5 I don't think it will work with Connext. I tried copying the nddsdotnet DDL's into my project folder and when I click on them in the Inspector they are shown as native instead of managed and the "Assembly Info" field (which should show the .NET version) is not displayed. Unity has a mono update on their roadmap and there are some preview betas available on their forums but the update isn't targeted for 5.6 so my guess is that it might be quite some time before we see it in a production release.

I believe the specific flavor of the tool the original poster linked to was actually VR-Link for Unity. This connects Unity with the DIS & HLA military simulation protocols, the latter of which has a component called the RTI (run time infrastructure) which is sometimes confused with the company but unfortunately this tool does not support DDS.

Unity also supports Javascript so it may be possible to use Connext via the RTI Connector.

Offline
Last seen: 2 years 9 months ago
Joined: 01/25/2017
Posts: 2

Upon further investigation I think the problem is that the Connext .NET DLL's aren't pure CIL (i.e. they're a mixture of managed and unmanaged code). Mixed assemblies aren't supported by Mono so unfortunately at this point I don't think Connext is going to be compatible with Unity.

sara's picture
Offline
Last seen: 2 months 2 days ago
Joined: 01/16/2013
Posts: 122

Hi,

As Constellation mentioned, RTI Connext for C# is based on CLI/C++ and it is not 100% compatible with Mono. That said, we are working on gathering interest from customers to see if we can create a new version of our C# API that is completly compatible with Mono. This would help not only people using Unity, but people using C# on Linux.

If you are interested, please contact your account team with your account information and let them know. If you are in Europe, you can contact me (I'm FAE in EMEA) at sara(AT)rti.com.

Thanks,

Sara

sara's picture
Offline
Last seen: 2 months 2 days ago
Joined: 01/16/2013
Posts: 122

Hi everybody,

Quick update on this. We created a version of Connector that enables RTI Connext for Unity 3D engine. You can find it in our github repository: https://github.com/rticommunity/rticonnextdds-connector-cs

All the best,
Sara

Edit: Updated repo link

Offline
Last seen: 6 months 4 weeks ago
Joined: 04/19/2019
Posts: 1

As a product modeler, I've composed numerous frameworks, switch ­engineered local code malware, and for the most part, could make sense of things on the code side. When it came to making amusements, however, I was somewhat lost with respect to where to begin. I had done some local code designs programming in the early Windows days, and it was anything but a fun encounter. I at that point began on DirectX improvement yet understood that, despite the fact that it was very amazing, it appeared as though a lot of code for what I needed to do.

At that point, at some point, I chose to explore different avenues regarding Unity, and I saw it could do some astonishing things. This is the primary article in a four-section arrangement that will cover the nuts and bolts and engineering of Unity. I'll tell the best way to make 2D and 3D diversions and, at long last, how to work for the Windows stages.

https://imessageforpc.org

Offline
Last seen: 3 weeks 1 day ago
Joined: 10/01/2019
Posts: 5

Hello all,

RTI Connext for C# is based on CLI/C++ and it is not 100% compatible with Mono. 

Just wondering if that means that the C# classes generated by rtiddsgen from an .idl file won't work in Unity still, as Sara mentioned in 2017? 

Is this still the case, and for RTI DDS to work, developers can only use Connector? https://github.com/rticommunity/rticonnextdds-connector-cs

Also, if that is so, I was wondering if it would be possible to add a sample showing Connector working in a Unity project?

I've placed:

RTI.Connext.Connector.dll
and
Newtonsoft.Json.dll
 
In my Unity project Assets, but I keep getting an error message of:
 
"DllNotFoundException: rtiddsconnector

RTI.Connext.Connector.Interface.Connector+ConnectorPtr..ctor (System.String configName, System.String configFile) (at <6764437bb1b649d99d0d1a325bf196a8>:0)
RTI.Connext.Connector.Interface.Connector..ctor (System.String configName, System.String configFile) (at <6764437bb1b649d99d0d1a325bf196a8>:0)
RTI.Connext.Connector.Connector..ctor (System.String configName, System.String configFile) (at <6764437bb1b649d99d0d1a325bf196a8>:0)
PublishMessage..ctor () (at Assets/Scenes/PublishMessage.cs:13)"

 
As far as I can see, the DLL appears to be there, but perhaps my project setup is somehow incorrect?
 
Thank you.

 

Offline
Last seen: 2 hours 48 min ago
Joined: 04/02/2013
Posts: 114

Correct, Connector doesn't use rtiddsgen-generated IDL types. The types are always configured in XML and accessed via the Connector API.

Regarding the DLL issue, have you tried adding the path to the Connector DLL to the PATH environment variable?

 

Offline
Last seen: 3 weeks 1 day ago
Joined: 10/01/2019
Posts: 5

Hi Alejandro,

Thanks for answering! My question was actually if I can use rtiddsgen IDL types directly with Unity (not through Connector)? Since what I'm building is essentially based off of generated .idl files?

I'll try adding the Connector DLL PATH and let you know!

Best regards.

Offline
Last seen: 3 weeks 1 day ago
Joined: 10/01/2019
Posts: 5

Hi Alejandro,

I added the rtiddsconnector.dll from here (https://github.com/rticommunity/rticonnextdds-connector/tree/master/lib) to my environment PATH, and it still did not work. I still received the same error message.

[EDIT: I was wrong, it works correctly now. Unity was being odd as I had to close and re-open Unity to see it. Thank you!]

 

So going back to my original question: can I use rtiddsgen generated C# files directly with Unity (not through Connector)? Or is the set up still not compatible with Mono? I'd prefer not to use Connector since I have an automated environment that generates idl files, and then calls rtiddsgen on it.

Offline
Last seen: 5 hours 58 min ago
Joined: 10/22/2018
Posts: 37

Hi Jade,

I am no expert in Unity, but above in this thread it was mentioned that the reason that our generated C# code cannot be used with Unity is due to the fact it is a mix of unmanaged and managed code.
This is still the case with our C# API, so unless something has changed on the Mono end then it will not be possible to integrate Unity with our rtiddsgen generated C# code.

It is possible to use rtiddsgen to convert IDL -> XML (using the -convertToXml command line option). Maybe this is something you can integrate into your automated environment to allow you to use Connector?

Offline
Last seen: 3 weeks 1 day ago
Joined: 10/01/2019
Posts: 5

Hi Samr,

Much appreciated for verifying, yes, I suspected it was so, and I didn't realize at first that Unity doesn't support mixed assemblies (due to Mono). Thanks for the tip on IDL->XML, I'll look into that and see if that works for the flow I am trying to create.

Offline
Last seen: 3 weeks 1 day ago
Joined: 10/01/2019
Posts: 5

May any of you know what may cause a SEHException when creating a connector?

SEHException: Error creating connector
RTI.Connext.Connector.Interface.Connector..ctor (System.String configName, System.String configFile) (at <6764437bb1b649d99d0d1a325bf196a8>:0)
RTI.Connext.Connector.Connector..ctor (System.String configName, System.String configFile) (at <6764437bb1b649d99d0d1a325bf196a8>:0)
PublishMessage.Start () (at Assets/Scenes/PublishMessage.cs:20)

It's used in a simple instantiation:

using UnityEngine;
using RTI.Connext.Connector;

 

public class PublishMessage : MonoBehaviour
{
    const string configPath = "/Scenes/Configuration.xml";
    const string topic = "HelloWorld RTI";

    void Start() {
        string path = Application.dataPath;
        Connector connector = new Connector(topic, path + configPath);
    }
}

Offline
Last seen: 5 hours 58 min ago
Joined: 10/22/2018
Posts: 37

Hi Jade,

It looks like you are creating the Connector object incorrectly. The first argument should be the name of the Connector conifguration in the XML file (i.e., the name in the ) which you supply in configPath.

If you look at this example, we create the connector as var connector = new Connector(configName, configPath)  where configName is "MyParticipantLibrary::Zero" -- this is formed as the names of the DomainParticipant library and Domain Participant in the XML configuration file.

Hope that helps,

Sam