• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by xpkoalz · Nov 21, 2015 at 02:30 AM · camerabackgroundtransparent

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 -

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image xpkoalz · Nov 24, 2015 at 09:49 AM 0
Share

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 Mask Settings: - to only the 3D object's layer - nope doesnt' work as well Unity always appears on top of iOS with a black background...

3 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

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..

  1. In Unity, MainCamera ClearFlags set to solid color with alpha = 0

  2. Export to iOS

  3. 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

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Diablo404 · Dec 11, 2015 at 05:00 AM 0
Share

So great. Thank you for that. Do you know if it's possible to do the same thing with a standalone app?

avatar image xpkoalz Diablo404 · Dec 11, 2015 at 01:55 PM 0
Share

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! :)

avatar image shahzaib · Mar 04, 2017 at 06:35 AM 0
Share

Hi, been looking for this for quite sometime now, do you know how to do this with Android?

Thanks a ton.

avatar image
0

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by shahzaib · Mar 04, 2017 at 06:37 AM

@xpkoalz

Any idea how to do it with Android?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

45 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to render object under everything else? 0 Answers

the code fiixing the size camera and the background 1 Answer

How to draw background image on camera without MVP Matrix 0 Answers

Alpha channel on camera 1 Answer

Help with this Camera Background Color Code 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges