1 2 Previous Next 16 Replies Latest reply on Jun 22, 2018 1:56 PM by OsaroChris

    D400 Unity plugin broken on OSX?


      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.

        • 1. Re: D400 Unity plugin broken on OSX?

          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.

          • 2. Re: D400 Unity plugin broken on OSX?

            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?

            • 3. Re: D400 Unity plugin broken on OSX?

              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?

              • 4. Re: D400 Unity plugin broken on OSX?

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


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

                • 5. Re: D400 Unity plugin broken on OSX?

                  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:


                  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.

                  • 6. Re: D400 Unity plugin broken on OSX?

                    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.

                    • 7. Re: D400 Unity plugin broken on OSX?

                      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.

                      • 8. Re: D400 Unity plugin broken on OSX?

                        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. 

                        • 9. Re: D400 Unity plugin broken on OSX?

                          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.

                          • 10. Re: D400 Unity plugin broken on OSX?

                            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.

                            • 11. Re: D400 Unity plugin broken on OSX?

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

                              • 12. Re: D400 Unity plugin broken on OSX?

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

                                • 13. Re: D400 Unity plugin broken on OSX?

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

                                  • 14. Re: D400 Unity plugin broken on OSX?

                                    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 <EnsureBitCorrectness> 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:
                                        • <BuildPath Condition="'$(BuildPath)'==''">..\..\..\build\$(Configuration)\realsense2.dll</BuildPath>
                                    • 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.
                                    1 of 1 people found this helpful
                                    1 2 Previous Next