- Home /
UnityAppController.mm copied in
Hello there,
We recently upgraded to Unity 4.2, however after following the upgrade notes regarding the Assets/Plugins/iOS folder, my custom UnityAppController.mm file is being copied to Libraries instead of Classes folder! Of course this causes duplicate symbol definitions in XCode 5.
Is there a workaround this?
Thank you in advance
I am working on the same problem. Did you find a solution?
I am unsure about the porting, but in XCode, if you click on the project name (the upper-left) you'll see the settings for the project. Off towards the right side tabs is the Build Phases, and Copy Build Phase has a bunch of include/don't include options usually. However I realize this may be more with your initial import than the phases it uses. Otherwise, you can just hit delete on a file in XCode and when it asks, say "Delete reference only" and the file will stay, but the 2 references will no longer exist, you'll only have one reference to it. Should give you something to toy with at least, but unsure about solving.
Thanks, feiting, but unfortunately that doesn't help my situation (or likely alkisbkn either). I use an automated build process that creates a new XCode project every time, so I can't modify the XCode project in this way.
$$anonymous$$ind of the reason they made UnityAppController.mm was to keep you from having conflicts with your own AppController. $$anonymous$$aybe you can solve the problem by making your AppController an extension of UnityAppController. https://developer.apple.com/library/ios/documentation/cocoa/conceptual/Program$$anonymous$$gWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html
Answer by vladimirg · Nov 13, 2013 at 04:57 PM
We solved this problem using a different approach: we subclass UnityAppController and patch main.mm to use our own class. Unity 4.2 makes this even simpler with the IMPL_APP_CONTROLLER_SUBCLASS macro.
It's a nice idea, however our automated build system IIRC, uses Replace build. main.mm would be replaced, so it's not really working in this case. Unless I am missing something?
There's no problem with Replace builds. Unity's post-build script runs after all the files are in place, so our changes are the last to happen and don't get overwritten. But that's one way. And again I suggest you to take a look at the I$$anonymous$$PL_APP_CONTROLLER_SUBCLASS macro. It allows subclassing UnityAppController without changing any Unity code. However, this will only work for Unity 4.2 and up (thus we're sticking to our post-build script).
Answer by eppz · May 12, 2017 at 03:11 PM
Just made a writeup on how to deal to deal with UnityAppController:
Override app delegate in Unity for iOS and OSX (1/4) Plugin workflow.
Basically two approach, one is doing with Notification Center, the other uses Method swizzling. Also there is an alternative for OSX.
Hello eppz, I read your blog post. I have an issue with two plugins which have bot overriden the AppControllerClassName
constant using the I$$anonymous$$PL_APP_CONTROLLER_SUBCLASS
, and obviously, this produces an error at startup.
$$anonymous$$aybe, you can give a hand ?
$$anonymous$$y question is here:
https://answers.unity.com/questions/1510598/appcontrollerclassname-override-conflict-between-t.html