Unity export with transparent background
hi all, have search everywhere for a straight answer to this. I'm trying to export a Unity scene and have it overlay on top of iOS. Is there anyway to do this? Does Unity offers any solution for this kind of integration with native mobile app? I've seen a demo of it on http://www.geekyhamster.com/2013/12/unityplayer-as-subview-with-transparent.html ...but the last comment says that it doesn't work in Unity5.x -
forget to add that I have experiment with Camera's Clear Flags Settings: - set to "Depth Only"/ "Solid Color" (alpha 0)/ - nope doesn't work have also set the Camera's Culling $$anonymous$$ask Settings: - to only the 3D object's layer - nope doesnt' work as well Unity always appears on top of iOS with a black background...
Answer by xpkoalz · Dec 10, 2015 at 02:36 PM
Thanks to someone who comment in the last post at: http://www.geekyhamster.com/2013/12/unityplayer-as-subview-with-transparent.html#comment-form_2814123588175991591
I tried it and it works nicely..
In Unity, MainCamera ClearFlags set to solid color with alpha = 0
Export to iOS
In Xcode classes folder, search for 2 files :
a - GlesHelper.mm in CreateSystemRenderingSurfaceGLES method - Add this line:-
surface->layer.opaque = NO;
b - MetalHelper.mm in CreateSystemRenderingSurfaceMTL method - Add these lines:-
surface->layer.opaque = NO;
CGFloat backgroundColor[] = {0,0,0,0};
ta-dah~~ transparent background. Tested on Unity version 5.2.3f
So great. Thank you for that. Do you know if it's possible to do the same thing with a standalone app?
Hmmm I'm afraid not. I haven't tried exporting Unity as a standalone app before..but good luck with your search. im sure theres an answer somewhere out there! :)
Hi, been looking for this for quite sometime now, do you know how to do this with Android?
Thanks a ton.
Answer by logiph · Aug 30, 2016 at 02:43 AM
Thank you for your question and reply, it guide me here, it works fine in unity5.4.0 intergate with my app.