Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
avatar image
1
Question by SioHio · Nov 18, 2015 at 01:08 PM · uiimagetransparencymask

Canvas with mask and transparent image

So if I use a mask to hide overlapping ui elements in my canvas (which is placed in world space) it also needs an Image comp. This image component causes the canvas to have a non transparent background which I dont want, so my current hack looks like this:

        canvas.AddComponent<Image>().color = new Color(0, 0, 0, 3f / 255f);
        canvas.AddComponent<Mask>();

I don't like it and on iOS it seems to cause problems, additionally it probably has some performance drawbacks.

Does someone know how to do this the right way?

Comment
Add comment · Show 2
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 ijidau · Nov 18, 2015 at 01:23 PM 0
Share

Are you maybe trying to do something that the UI has a native handler for? Why do you need to hide overlapping elements? What do you mean?

avatar image SioHio ijidau · Nov 20, 2015 at 12:11 PM 0
Share

Generally I just want to use a $$anonymous$$ask in combination with a transparent Image

$$anonymous$$ask in general is very useful for UI for example if you place a canvas as a 3d element in the scene

1 Reply

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

Answer by Dinosaurs · Nov 20, 2015 at 01:33 PM

If you set showMaskGraphic to false on the Mask, the image should be invisible.

http://docs.unity3d.com/ScriptReference/UI.Mask-showMaskGraphic.html

Comment
Add comment · Show 1 · 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 SioHio · Nov 20, 2015 at 01:35 PM 1
Share

thanks thats what I was looking for

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.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I make nested UI Image elements the same transparency? 1 Answer

Get current sprite from filled Image PRESERVING ITS TRANSPARENCY 0 Answers

On Pointer Enter for semi-transparent UI? 2 Answers

Aliasing When Using UI Mask 3 Answers

How do I save masked user entered image? 0 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