Hi,
Build on IOS running time : too long.
The workflow to build from unity to iOS device takes a lot of time. 10Mn, 20mn for some projects.
We got the issue with Frant’s garden also. It’s a lot of time. But the worst is when the build time from Xcode that takes forever. And the biggest issue is when all that is for nothing because you have a build Failed at the end just because some native plugin you have in your unity projects has not been copied properly during the xCode export.
Here is the solution : Post Processing script.
You have some example of what is it here for the curious:
http://answers.unity3d.com/questions/220259/postprocessbuildplayer-not-working-in-35-after-upg.html
We took some sample and we modify it to take care of our beloved native frameworks (monetizations frameworks ads like chartboost, vungle and other mediation stuff like mopub and so on.
One of the issues is also to setup properly the arc flag on some files, here is how it got working to add the proper compiler flag in xcode.
Thanks to the Install mod_pbxproj module from Python.
<code> import mod_pbxproj from mod_pbxproj import XcodeProject project = XcodeProject.Load( pathToProjectFile + '/Unity-iPhone.xcodeproj/project.pbxproj') # files that require ARC need to be handled here filesThatRequireArc = [ 'FacebookNativeAdAdapter.m', 'UnityAdsMopubEvent.m', 'MPVungleRouter.m' ] for arcFile in filesThatRequireArc: temp = project.get_files_by_name( arcFile ) if temp: buildFiles = project.get_build_files( temp[0].id ) if buildFiles and len( buildFiles ) > 0: for buildFile in buildFiles: syslog.syslog( syslog.LOG_ALERT, 'swapping ARC flag on for file: ' + temp[0].get( 'name' ) ) buildFile.add_compiler_flag( '-fobjc-arc' ) else: syslog.syslog( syslog.LOG_ALERT, 'could not find file to switch compile type to ARC' ) </code>
Change language in application
A usefull snippet if you want to change the locale of the app without having to go through the settings.
Configuration conf = getResources().getConfiguration(); conf.locale = new Locale(iso3SupportLanguage[position]); DisplayMetrics metrics = new DisplayMetrics(); WindowManager wm = (WindowManager) getActivity().getSystemService(Activity.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(metrics); getResources().updateConfiguration(conf, metrics); Resources resources = new Resources(getActivity().getAssets(), metrics, conf); resources.updateConfiguration(conf, metrics);
There is no native FlowLayout component, so for people. The following library gives a hand, but changing the space between category can be tricky, so we made it as default to get things done.
Take a look if you are interested:
What is the problem?
Slow to build the app if the app is multi-dex (over 65K method). And the build time is taking more than 1mn.
What’s the solution?
We can configure to make build multi-dex faster. Your device just need to have Android Lollipop or up.
Configure gradle like below
android { productFlavors { // Define separate dev and prod product flavors. dev { // dev utilizes minSDKVersion = 21 to allow the Android gradle plugin // to pre-dex each module and produce an APK that can be tested on // Android Lollipop without time consuming dex merging processes. minSdkVersion 21 } prod { // The actual minSdkVersion for the application. minSdkVersion 14 } } ... buildTypes { release { runProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile 'com.android.support:multidex:1.0.0' }
When building, select devDebug in Build variant
More detailed stuff from here: https://developer.android.com/studio/build/multidex.html