Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use the unity wrapper with the MacOS library? #1576

Closed
krstns opened this issue Apr 19, 2018 · 10 comments
Closed

How can I use the unity wrapper with the MacOS library? #1576

krstns opened this issue Apr 19, 2018 · 10 comments

Comments

@krstns
Copy link

krstns commented Apr 19, 2018

Required Info
Camera Model D415
Firmware Version 05.08.15.00
Operating System & Version MacOS
Platform PC
SDK Version 2.2.10.4 }

Issue Description

I want to use the unity wrapper on MacOS but it comes only with the dll's. Is it possible to make it work with the librealsense2.2.10.4.dylib?
Or is there something else involved? I can see two dll's are required when running on windows.

Thanks

@dorodnic
Copy link
Contributor

Hi @krstns
At the moment we limit the Unity support to Windows version only.
Getting it to run on Mac should be possible (by compiling the library with XCode and the .NET wrapper with MonoDevelop) but it wasn't sufficiently tested and documented yet.

@eccoscreen
Copy link

Has anyone figured out how to do this? I tried the above comment but I'm not sure if I did it right.

@krstns
Copy link
Author

krstns commented Apr 25, 2018

@eccoscreen I can build the library on macos using the guide from github, but I can't get the wrapper to build. I am no fan of mono and maybe that's why. I will give it a go in the coming days, but if you will figure it out before, please let me know how i can get that done.

@krstns
Copy link
Author

krstns commented May 18, 2018

Actually, it was quite simple. Just load the sources in Visual Studio for Mac 2017, select the wrapper and build.

@krstns krstns closed this as completed May 18, 2018
@eccoscreen
Copy link

Hey I've gotten that part to work but it still doesn't detect in unity. Do you have any idea how to get Unity to recognize the plugin?

@krstns
Copy link
Author

krstns commented May 19, 2018

So, what I did was:
follow the guide of getting the librealsense on macos as described in here: https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_osx.md

Then I have installed the Visual Studio 2017 for Mac (BTW, well done Microsoft, you have delayed the decission of moving my intellij license to my windows installation by 30minutes... which is 30 minutes longer than before ).

Then I have loaded the csharp wrapper solution inside the VS and simply hit build. Mind you, you might want to change the type from Debug to Release.

It will give you a DLL file, with the same name as the one attached to the Realsense unity package, I have changed the extension to .dylib.

Now copy the dylibs created from the librealsense project and the Intel.Realsense.dylib you have just built to the Plugins directory where you have the original original unity asset's dlls.

Then in Unity, it will give you quite some errors. You have to select the original DLLs and in inspector mark them as macos only. In case of the original DLLs, mark them as windows only.

From my memory, this was enough to get it going and working. Remember to attach your camera to the correct port (best check with the Realsense viewer, it has the indication whether it is USB 2.1 or 3 or 3.1). In my case (old 2013 macbook pro) i had to use the right usb and Realsense viewer showed it as 3.1 (which i don't have ;) ). Anyway, then I was able to select the resolutions I wanted. Once you are done there, kill realsense viewer and apply the same resolution and framerate configuration there.
After this, it started to work for me.

If you have any questions, I will be happy to answer, it was not detailed because I am away from my laptop and on windows at the moment.

EDIT:
oh yes, I have also seen something really strange: when I unmark the original windows dll from being used by the Editor, it will give me a lot of errors, so... I have both - DLL and dylib marked as used by the editor. I found it really weird, but well... if it works ...

@eccoscreen
Copy link

@krstns Yeah I'm still getting a bunch of 'Intel' could not be found errors. What are the names of the files you've added and in which folders did you add them to?

@krstns
Copy link
Author

krstns commented May 23, 2018

@eccoscreen here's a little screenshot with all the details you asked for.

image

@cansik
Copy link

cansik commented Nov 5, 2018

I also created an example unity project for MacOS and the D435. Running smooth now, but rosbag playback and some other things are not working:

https://github.com/cansik/realsense-unity-mac

@CharStiles
Copy link

CharStiles commented Mar 7, 2019

@krstns I was wondering how you compiled the csharp wrapper solution on mac, I tried by downloading visual studio for mac and following the instructions to generate the sln, but cmake wont let me choose visual studio for mac as the generator. I am going to try creating the solution on windows since i gathered the .NET framework on VS is supposed to be cross platform.

At the end of the day I am trying to just get the realsense working in unity on a mac, unfortunately the example @cansik made is crashing unity for me.

thanks so much for any help, i am very green to all of this, so any pointers are appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants