need help with setup (iMSTK-Unity)

Hello, this is kinda newbie question but I need help

I am Mac user and trying to use iMSTK-Unity, and when I import the iMSTK asset error occurs

Assets/Imstk/Scripts/Devices/OpenHapticsDevice.cs(38,29): error CS0234: The type or namespace name ‘HapticDeviceManager’ does not exist in the namespace ‘Imstk’ (are you missing an assembly reference?)

I checked the READ ME and website for setup. What I understand is I need to use cmake and build the iMSTK.

I am stuck in this part.

I downloaded the cmake, made iMSTK_build (mkdir iMSTK_build)

but for the path. I am not sure what to put. Do I need to make seperate folder or I need to use the path of unity project? (Which path to put source code and which path to put build?)

then I also need cmakelists.txt. Do I need to make one?

I searched about cmake and checked other questions posted here, but I don’t think I understand this well.

Please help me. I just want to run sample scene and check it by Unity.

Thank you.

Hi Shiloh I’m away from my computer today but first up we haven’t neither tested imstk on the Mac nor the imstk Unity package, and we’re not really supporting it, you’ll be the first.

I’m only on the phone atm I should be able to give you a better answer tomorrow.

Thank you for your reply.

I didn’t know iMSTK haven’t tested on the Mac. I hope there is the way to use it. I am really really interested in it.

I will wait your answer tomorrow.

To lead off as i said we have neither tested imstk nor imstk unity on mac os, and we are currently not supporting it, I can get you started and help through the forum but we probably won’t be able to fix any issues that come up. There are 3 layers that need to work together for the fully functioning unity asset.

  1. The iMSTK library itself
  2. Swig generated C++ to C# wrapping code
  3. The iMSTK-Unity library with the above installed

As we’re not supporting OSX you will probably have to know some CMAKE to make changes, you might also need to edit some of the C++ code if something breaks.

It would be great if you could use the main-version-2 branch of iMSTK-Unity it is the most up to date version and it’s what we are going to base the next release on. IMSTK-Unity has iMSTK as a subproject under the ImstkSource~ directory, use that source folder for building the binaries it is the correct version for that version of iMSTK-Unity.

I’d also install ccmake it’s a terminal GUI for cmake and will make handling cmake a bit easier. but once you’ve checked out the repository from above. You can do

cd <path to repo>/ImstkSource~/
mkdir iMSTK_build
cd iMSTK_build
cmake ../iMSTK
make -j4

If you have never worked with cmake i’d sugest looking at a few tutorials.

The line cmake ../iMSTK just means run cmake with the data found in the directory ../iMSTK which is the directory that was checked out from the repository. If you can run make and everything builds correctly that would be a good check, there is no reason for some of the other steps if this doesn’t work.

Hello, Mr. Harald

Thank you for your detailed answer.

I tried to follow what you told me. Not sure if this is going right though.

So I downloaded imstk-unity-main-version-2 zip folder, unziped it.

cd /Users/Destop/imstk-unity-main-version-2/ImstkSource~
mkdir iMSTK_build
cd iMSTK_build

Then I download imstk libarary from here

cmake /Users/Desktop/iMSTK-master

It says
Build files have been written to: /Users/Desktop/imstk-unity-main-version-2/ImstkSource~/iMSTK_build

Then I did
make -j4

It says

This is what I got after the cmake in iMSTK_build folder

So if there is nothing wrong in the process that I did, what should I do for unity.

Should I create a new unity project, drag imstk-unity-main-version-2 folder (where iMSTK_build folder is) and plug it inside the unity?

+) I just made new unity project, and imported imstk-unity-main-version-2 folder.
This is still what I got

+) And if I import iMSTK by Assetstore, I got DIINotFounException Error

Hello, Harald

I am still getting trouble with using iMSTK_unity

May you please help me?

The asset from the assetstore won’t work, it does not support OSX, I’m checking with colleagues atm

Can you post the content of the install folder please ?

I am not 100% sure what you mean by the install folder, but this is imstk-unity-main-version-2 folder

Inside of ImstkSource~ there is iMSTK_build
And I build the cmake file here

and I drag imstk-unity-main-version-2 folder insdie unity

스크린샷 2023-09-14 오후 7.42.51

This is what happen when I import the imstk folder

Is this what you meant content of the install folder?

I just found this part

Do I need to do this part? Is it by terminal?

Sorry I missed your reply, you should turn off OpenHaptics and VRPN for testing. I attempted to build imstk on my mac but it was not fully building so i’m not sure if you have a complete build

The problem is that we haven’t tested iMSTK on OSX at all and you’re trying to go directly to unity. There are multiple layers that all need to work so that the overall unity integration works. The steps i would usually do is

  1. Build iMSTK by itself :with test, with examples on, in your case without Openhaptics, without VRPN
  2. Run the unit tests see if they are suceeding, run the examples see that they are working (the unit tests are more important than the examples) if they aren’t working, fix that before proceeding to the next step
  3. Turn on C# wrapping, build the wrapping, build the C# examples see if those are working, if not analyse and fix
  4. Now switch to BUILD_FOR_UNITY that turns off the examples and rendering, make sure to turn off VRPN, turn off Openhaptics.
  5. All the binary files in the install folder need to go into the Unity plugins folder. But as i can’t build it sucessfully i can’t tell you which those actually are.

So step by step you need to resolve any of the issues that come up, issues could be the build process not succeeding, or the software not working. If you skip any of those steps you will really mostly just see the unity integration not working but not know why.