Items with no label
3335 Discussions

D400 Unity plugin broken on OSX?

RGood4
Beginner
3,599 Views

I just downloaded the latest version of the SDK from Github and I'm getting this error several times:

error CS0246: The type or namespace name `Intel' could not be found. Are you missing an assembly reference?

Does anyone have any idea why the plugin isn't working out of the box? Latest version of Unity, it's an empty scene and the D435 is plugged in.

0 Kudos
16 Replies
MartyG
Honored Contributor III
1,076 Views

May I please confirm with you if the Unity plugin files have been installed in your Unity project and in the correct locations? On my Windows installation of the SDK (I do not have a Mac to check the location on), the files are located in this SDK 2.0 folder:

Intel RealSense SDK 2.0 > bin > x64

The plugin files that Unity needs are called LibrealsenseWrapper.dll and realsense2.dll.

You should go to your Unity 'Assets' panel, locate the folders 'Plugins' and 'Plugins,Managed' and do the following:

1. Drag and drop the realsense2.dll file from its original SDK folder into Unity's Plugins folder

2. Drag and drop the LibrealsenseWrapper.dll file from its original SDK folder into Unity's Plugins.Managed folder

After these steps are completed, you can then open a Unity scene.

0 Kudos
RGood4
Beginner
1,076 Views

I download the SDK 2.0 off of Github, but the Unity project does not have the 'Plugins' or 'Plugins.Managed' folders. I don't see the bin folder anywhere, and looking through the github I don't see it anywhere there either.

Why would Intel post incomplete code like this?

0 Kudos
MartyG
Honored Contributor III
1,076 Views

As I do not have a Mac, I cannot check the folder structure of the SDK installation on your machine. Would it be possible to put the name of one of the files into a search box on your SDK folder and find the files that way?

0 Kudos
RGood4
Beginner
1,076 Views

The folder structure is here: https://github.com/IntelRealSense/librealsense GitHub - IntelRealSense/librealsense: Intel® RealSense™ SDK

It's not there when I search my computer or the repository.

0 Kudos
MartyG
Honored Contributor III
1,076 Views

Apologies for the delayed response. I was thoroughly researching your case.

It seems that you get the Realsense2.dll file by building the RealSense SDK 2.0 source, and then get the LibrealsenseWrapper.dll file by going to the wrappers/charp section of the SDK structure and building the file Intel.RealSense.SDK.sln

The Wrappers > Csharp section of the SDK structure:

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/csharp librealsense/wrappers/csharp at master · IntelRealSense/librealsense · GitHub

At this point there is a problem though. It says that the solution (sln) file only currently works with Windows. So I am not certain how you would gain that file with a Mac. The best I can think of is to attach the two DLL files to this message, which I have done, so you can try importing them into the Plugins and Plugins.Managed folders in Unity.

Regarding not having Plugins / Plugins.Managed folders in your Unity project: I started a new project to check this and confirmed that a new project did not have these folders. So simply create these folders in your Assets windows and place the DLLs in the appropriate folder according to the instructions.

0 Kudos
RGood4
Beginner
1,076 Views

That is fantastic, I appreciate all of your help. Do you work for Intel?

It still perplexes me that these files are not already included in the Unity project. Why don't Intel just include a .unitypackage file like they did with the old realsense SDK, and like every other SDK developer does?

It seems needlessly complicated and will likely turn away many developers.

Thank you again.

0 Kudos
RGood4
Beginner
1,076 Views

Unfortunately it still does not work on OSX.

DllNotFoundException: realsense2

Intel.RealSense.Colorizer..ctor ()

ColorizeDepth..ctor () (at Assets/RealSenseSDK2.0/Scripts/ColorizeDepth.cs:9)

LibrealsenseWrapper.dll has support for OSX x64, but realsense2.dll is Windows only.

0 Kudos
MartyG
Honored Contributor III
1,076 Views

I'm glad I could be of help. I am not an Intel employee, I am a volunteer support guy known as a 'Super User'.

Yes, a pre-made package file in the style of the old Unity Toolkit executable would be very useful. As it would have to be updated with a new Realsense2.dll every time a new SDK build was released though in order to reflect the latest changes in the SDK, this may be more trouble than when the old Windows SDKs were updated on a roughly 6 month schedule. The simplest approach may be to put download links for the latest versions of these two DLLs on a web page, since Intel will have to build the files anyway for the binary version of the SDK.

I just saw your latest message. It is a positive at least that LibrealsenseWrapper.dll is the one that works with Unity, as that is the one that is potentially the most complicated to build for Mac. You should be able to obtain realsense2.dll in theory just by building the SDK 2.0 on yur Mac. Whether that Mac-built DLL will work in Unity, I cannot say.

0 Kudos
CVigo
Beginner
1,076 Views

Did anyone get this working? In the same situation and hitting the same error posted in the most recent reply: DllNotFoundException: realsense2

Tried building the lib directly from the XCode project but doesn't seem to work. Can get everything to work on Linux but not OSX.

0 Kudos
CVigo
Beginner
1,076 Views

Actually I spent some more time on it and it looks like I just needed to rename the native library I built from the XCode project from realsense2.dylib to realsense2.bundle so Unity would recognize it.

0 Kudos
MartyG
Honored Contributor III
1,076 Views

I'm very glad you got it working. Thanks for the update!

0 Kudos
CCarl8
Beginner
1,076 Views

That's amazing you got it working! I'd would be wonderful if you could share the dylib.

0 Kudos
CVigo
Beginner
1,076 Views

Sure. I've attached the libs I'm currently using. The managed wrapper and the MacOS native bundle. Compiled for .NET 4.6.

0 Kudos
CVigo
Beginner
1,076 Views

Actually the ones I posted were for SDK version 2.10.1. I'm attaching the ones for the latest SDK version 2.12.0.

Here are the rough steps I took to compile them. They may not all be necessary but this is what worked for me.

  • Open XCode project and build librealsense2 target for Release.
  • Copy built dylib to Unity project in Plugins directory and rename to realsense2.bundle
  • Open wrappers/csharp/Intel.RealSense/Intel.RealSense.csproj
    • Delete/comment out target element
    • Delete/comment out 'DependsOnTargets="EnsureBitCorrectness"' attribute in "IncludeDependencies" target element.
    • Change 'realsense2.dll' in following line to point to built dylib file name from above:
      • ..\..\..\build\$(Configuration)\realsense2.dll
  • Open wrappers/csharp/Intel.RealSense.SDK.sln in .NET IDE
    • Build Intel.RealSense project for Release.
  • Copy Intel.RealSense.dll in bin/x64/Release/net461 to Unity project in Plugins directory (or whatever .NET framework you want to target). If you use .NET 4.6 you need to switch to that scripting engine in the Player settings.
0 Kudos
JBach2
Beginner
1,076 Views

Thanks for sharing this. I'm still getting the following error

 

"

Assets/RealSenseSDK2.0/Scripts/AlignImages.cs(2,7): error CS0246: The type or namespace name `Intel' could not be found. Are you missing an assembly reference?

Could you share your folder structure for your Unity Assets folder?

Are both DLLs inside your Plugins folder?

0 Kudos
CVigo
Beginner
1,076 Views

Yes I just put them both in the Plugins folder. It should work with the folder structure of the Unity project included in the SDK if you just add the Plugins folder and put the libs in there. If you're using the libs I posted, did you switch to .NET 4.x scripting runtime in the player settings? I only posted the 4.6 libs. The managed dll needs to match the .NET target of the scripting runtime. I'm attaching the .NET 3.5 version if you're trying to use that.

0 Kudos
Reply