Search Unity

Unity 4.6 Mask not working in iOS

Discussion in 'UGUI & TextMesh Pro' started by ApoorvaJ, Sep 19, 2014.

  1. ApoorvaJ

    ApoorvaJ

    Joined:
    Jan 9, 2013
    Posts:
    4
    The new Mask component is not working on iOS. It is working correctly in preview mode when running on Mac or Windows, but when deployed to an actual iOS device (iPad 3rd gen, in my case) the mask is completely ignored and the children of the mask object are rendered even outside the mask.

    I am on 4.6 beta 17.

    Is this a bug, or am I missing something?
     
  2. hamstar

    hamstar

    Joined:
    Sep 25, 2013
    Posts:
    84
    I believe that you have to tick "Use 24-bit Depth Buffer" in Player Settings > Resolution and Presentation. I'm not really sure why though.
     
  3. ApoorvaJ

    ApoorvaJ

    Joined:
    Jan 9, 2013
    Posts:
    4
    Thanks, hamstar. Worked like a charm.
     
  4. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Still not working for me. I'm loading a JPG into a Raw Image component that is being masked at runtime. It acts as though the mask simply isn't there.
     
  5. BA_Studio

    BA_Studio

    Joined:
    Jan 14, 2014
    Posts:
    3
    I had a similar issue in the unity editor and after switching to another platform and back it worked for me.
     
    yashpal and pea like this.
  6. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Hmm. No dice for me. Thanks for the suggestion though Marcel71.
     
  7. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,225
    You image needs an alpha channel for masking.
     
  8. melkior

    melkior

    Joined:
    Jul 20, 2013
    Posts:
    199
    Just to be clear .jpg's don't have alpha channels. (may not be apparent to everyone)
     
  9. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Ah I see. That makes sense. I'll look into this. Hopefully I can add an alpha channel to the image at runtime, as it's a JPG loaded off a web server. The mask I'm using is a PNG with alpha channel. But I guess what you're saying is that the masked image also needs an alpha channel that the mask will be applied to?
     
  10. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
  11. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
  12. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    I've got this same problem, but I'm using .psd files, all with full alpha (they're borders and semi-transparent background fills and what not).

    Could there be another reason the masks do not work?
     
  13. pea

    pea

    Joined:
    Oct 29, 2013
    Posts:
    98
    Are you running the latest beta? The issue resolved itself for me in b20.
     
  14. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    b19. I've downlaoded b20 but it broke some stuff with a plugin (InControl) that I have to use, so I figured I'd let that developer have a bit more time before pestering them for another 4.6 update :) Fortunately the game still works just fine w/o the mask, it just looks better with it. So I'll keep on keeping on.
    Thanks!
     
  15. korbain

    korbain

    Joined:
    Sep 11, 2013
    Posts:
    5
    b20. I had the same issue with the mask not working on iOS and by ticking "Use 24-bit Depth Buffer" in Player Settings > Resolution and Presentation, it fixed my problem (thanks hamstar). To Unity folks, please add this info in your documentation.
     
    infinitypbr likes this.
  16. infinitypbr

    infinitypbr

    Joined:
    Nov 28, 2012
    Posts:
    3,149
    b19 having the 24-bit depth buffer checked also worked for me. (Both of the boxes are checked)
     
  17. TeorikDeli

    TeorikDeli

    Joined:
    Apr 6, 2014
    Posts:
    149
    I still have this issue on iOS (8.1) with Unity 4.6p1. Also 24-bit depth buffer checked worked for me.
     
  18. pranay.inferno

    pranay.inferno

    Joined:
    Oct 5, 2013
    Posts:
    1
    go to build settings -> other settings -> device filter
    and select ARM v7
    worked for me....