Unity3D integration with UIView

前端 未结 4 1639
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-01 07:22

Please correct me if this question is duplicated. I just came across Unity3D and I just want to ask if it is possible to integrate Unity3D on top of other UIView?

相关标签:
4条回答
  • 2021-02-01 07:58

    As there is no Guide to manage this with the brand new Unity 5 (with IL2CPP Backend for 64 Bit) and Vuforia 4.x - i decided to write down my experience with it in a short tutorial.

    http://www.makethegame.net/unity/add-unity3d-to-native-ios-app-with-unity-5-and-vuforia-4-x/

    Hope it helps someone as it was a really bad task.

    0 讨论(0)
  • 2021-02-01 08:10

    Yes it is.

    This thread goes into detail: http://forum.unity3d.com/threads/unity-appcontroller-subclassing.191971/

    One of the Unity developers even posts example code. Not how to specifically put Unity on a UIView, but how to encompass the Unity AppController to do ultimately whatever you want with it.

    I have been maintaining hybrid Unity CocoaTouch apps for a few years. It used to be a complete hack. Now Unity has marginal support for it based on the things outlined in that thread. But it is a chore to keep it maintained. iOS and Unity slightly change every release, thus you must reintegrate unity into the iOS app a little different each release. Sometimes weird issues have come up that took me days to resolve. I personally, from experience, would avoid doing Unity and CocoaTouch hybrid apps for anything serious and highly predictable until they make it a bit more official. Ideally have official documentation about it in the manual. Not just have one of the developers posting code examples and the forum.

    0 讨论(0)
  • 2021-02-01 08:17

    I think it's not possible that way because the generated AppController.mm acts as UIApplicationDelegate. And even if you manage to get it working, it sounds like you won't have fun on the long run. Major Unity3D updates might change some internals.

    But the other way round i.e. calling Obj-C code from Unity3D and showing arbitrary UIViews is definitly working. See How to use an xcode game on unity3d especially Clever Martian's Blog - An Experiment with iPhone Native UI and Unity 3 Pro.

    0 讨论(0)
  • 2021-02-01 08:19

    Maybe, but it's far easier to go the other way around. Use Native Toolkit:

    http://u3d.as/content/prime31/native-toolkit-unity-to-i-os-bridge/1vj

    With this, you can bring up UIViews on top of your Unity3D app. It works great and is very easy to use. This is basically a plug and play version of what's described in the blog posts linked to in Kay's answer, I think.

    0 讨论(0)
提交回复
热议问题