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

Issue about building second time with Ionic #1

Closed Frobei closed 7 years ago

Frobei commented 7 years ago

Hi,

I worked on integrating Unity into a Cordova app (only on Android for now) and I found a better way to avoid error while building with Cordova a second time. Actually, what makes the error is the file Settings.Gradle is auto-generated during the building so it overrides the line

project(':UnityProject').projectDir = new File('C:\absolute path\to your\unity export folder')

Basically you'll need to add this line each time after you build Cordova. But there is another way, you can add this line automatically. To do so, you'll need to

I did this with Cordova but I think it would be no different with Ionic, and thanks to that you don't need to remove then add android platform, which requires to re-import Unity and redo all the code on AS each time.

Hope this will be useful for you !

yasirkula commented 7 years ago

That is handy tip to know, thank you. The reason I have suggested removing and adding the android platform is actually because the UnityArCallerPluginIonic plugin depends on the unity-classes.jar file that we remove from the jniLibs folder and ionic build gives errors if the file does not exist. Readding the android platform replaces the removed unity-classes.jar with a new one but maybe just ionic prepare android would suffice in that case, I should check it.