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

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

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

44 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

Related Questions

Camera doesnt react to Pivot Point setting 1 Answer

Keep Top Down 2D camera in bounds of background sprite 3 Answers

Why do objects go grey at a distance and why isn't the background white? 1 Answer

Camera background color don't update when changing it from code 1 Answer

How to Raycast from object to Orthographic camera 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges