yasirkula / UnityIonicIntegration

A guide to integrating Unity 3D content into an Ionic app and sending messages between them (for Android & iOS)(tested with Vuforia plugin)
104 stars 32 forks source link

EasyAR and VoidAR integration #48

Closed juan9506 closed 5 years ago

juan9506 commented 5 years ago

Hi, this is not an issue, it's just to let you and the users know that this also works with EasyAR and VoidAR. I already managed to make this work perfectly with those SDK's. Here's how I did it:

For Android: *All the unity steps are the same, then, after building the project for gradle, you just have to add the following line in the dependencies of the build.gradle file of the Ionic project (platforms/android/build.gradle):

For EasyAR: compile fileTree(dir: '/<path to your Unity exported project>/libs', include: 'EasyAR.jar')

For VoidAR: or compile fileTree(dir: '/<path to your Unity exported project>/libs', include: 'VoidAR.jar') Remember to change the path for your relative or absolute path.

image

Because if you don't reference the .jar file there, the module will close because it can't find the .jar classes.

For IOS: The steps are literally the same, but when you open the AR view, you will probably get a black screen. If that's happening, do the following: 1) On Classes/AppDelegate.mm add the following lines at the top under the imports:

extern "C" void ezarUnitySetGraphicsDevice(void* device, int deviceType, int eventType);
extern "C" void ezarUnityRenderEvent(int marker);

Then, in that same class, on the shouldAttachRenderDelegate() method, add the following inside the if: UnityRegisterRenderingPlugin(&ezarUnitySetGraphicsDevice, &ezarUnityRenderEvent);

I hope it helps.

yasirkula commented 5 years ago

Thank you for this informative guide!