SoftMaskForUGUI icon indicating copy to clipboard operation
SoftMaskForUGUI copied to clipboard

It works in Editor but not in Android

Open sametbaykul opened this issue 11 months ago • 9 comments

Hi,

Describe the bug I use this asset for tutorial highlights for a long time. Briefly, I use an image that fades the entire screen. I use a soft mask in the areas I want to highlight.

I upgraded the asset from 1.0.2 to the current version 3.1.2. The soft mask still works fine in the editor. But soft mask didn't work in android build any more.

I updated all required shaders on Player Settings (Plz look at screen shot). Ekran Resmi 2025-12-31 14 48 04

Environment (please complete the following information):

  • Version 3.1.2
  • Platform: From MacBook Air M1
  • Unity version: 2021.3.44f1 Personal
  • Build options: IL2CPP

sametbaykul avatar Dec 31 '24 11:12 sametbaykul

Thank you for your reporting! Could you please attach a minimal project (included Assets, Packages and ProjectSettings directories) that reproduces the issue? Of course, you don't need to include any secret assets from your project. Feel free to use free assets instead.

repos

mob-sakai avatar Dec 31 '24 12:12 mob-sakai

I would like to know more about this issue.

  • Does this issue also occur in Screen Space - Overlay or Screen Space - Camera modes?
  • Are you using URP (Universal Render Pipeline)?
  • Are you using ShaderGraph?
  • Are you using the RGB ETC1 (+ Split alpha channel) texture format?
    • That format is not supported.
    • For details, see https://github.com/mob-sakai/SoftMaskForUGUI?tab=readme-ov-file#warning-limitations
  • Do you use materials other than UI/Default for masked Graphics?
  • Do you use Dynamic Resolution or Render Scale in URP Asset?

mob-sakai avatar Dec 31 '24 12:12 mob-sakai

  • Screen `Space - Camera' mode
  • URP
  • No ShaderGraph
  • Texture Compression Format > ASTC (I also tried with ETC2, but no luck)
  • No any other material used (Standard)
  • Render Scale > 1, No dynamic resolution

sametbaykul avatar Dec 31 '24 13:12 sametbaykul

Thank you.

If you are in a hurry, consider using the 'Anti Aliasing' mode.

Could you please attach a minimal project (included Assets, Packages and ProjectSettings directories) that reproduces the issue? Of course, you don't need to include any secret assets from your project. Feel free to use free assets instead.

mob-sakai avatar Dec 31 '24 23:12 mob-sakai

No any other material used (Standard)

"Standard" means "UI/Default", right?

mob-sakai avatar Dec 31 '24 23:12 mob-sakai

Since I work in a huge project, it is not possible to share or repro the same issue. But I can provide project settings you ask. Yes, I used "Hidden/UI/Default (SoftMaskable)" shader. "Anti Aliasing" mode didn't work in Unity Editor. Subtract masks disappeared.

sametbaykul avatar Jan 01 '25 10:01 sametbaykul

Start with an empty project and create a scene that reproduces the issue.

No images or scripts are required.

mob-sakai avatar Jan 01 '25 10:01 mob-sakai

"Anti Aliasing" mode didn't work in Unity Editor. Subtract masks disappeared.

It is probably due to the sorting order of the objects. Place MaskingShape(Subtract) in the hierarchy above.

mob-sakai avatar Jan 01 '25 10:01 mob-sakai

First of all, thank you for your interest and such an amazing tool. Unfortunately, I don't have a chance to create a new project to reproduce the issue, I hope you understand this. However, I did some experiments and I would like to share my notes.

  • After making the correct order, the anti-aliasing mode worked. I decided to proceed this way for now. (Shortcut Solution)
  • After setting SoftMask, SoftMaskable, MaskingShape in the hierarchy panel in Editor Mode, there is no problem in both the Unity editor and the Android device. Same as in the example scene. (Static Solution)
  • However, problems may occur when these components are started or modified at runtime. For example, when a component is enabled/disabled, the image source or transform scale is changed etc. (Dynamic Solution has some issues)

I think some precautions or guidance can be made for this:

  • If the components are to be started at runtime, in which order should they be started? A directive can be prepared for this.
  • We can use a method like Refresh or Update to prevent buffer delays and possible problems after modification processes.

Please also note that, I don't have much experience with shaders. I use this package as a part of a versatile tutorial system. Therefore, the GameObjects and components used are constantly changing in runtime. I hope these notes can be helpful for further improvements.

sametbaykul avatar Jan 07 '25 08:01 sametbaykul

I has same issue in my project Environment (please complete the following information): SoftMask-Version 3.3.4 Platform: Editor(Windows) Unity version: 2021.3.10f1 Universal RP 12.1.7 SoftMaskErrorProj.zip

work error in DX11

Image

work correctly in -force-gles

Image

linkabox avatar Jul 28 '25 12:07 linkabox