mob-sakai / SoftMaskForUGUI

Enhance Unity UI (uGUI) with advanced soft-masking features to create more visually appealing effects!
https://github.com/mob-sakai/SoftMaskForUGUI
MIT License
2k stars 262 forks source link

Windows build having errors with TextMeshPro using SoftMask #177

Closed jewelvjohn closed 1 month ago

jewelvjohn commented 1 month ago

I was using the TextMeshPro Support (ugui 2.0). It worked great, everything was crisp in the unity player, but on the windows build the text didn't show up and it said this error:

Error ArgumentNullException: Value cannot be null. Parameter name: shader at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader) at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00008] in C:\build\output\unity\unity\Runtime\Export\Shaders\Material.bindings.cs:18 at Coffee.UISoftMask.SoftMaskUtils.GetSoftMaskingMaterial (UnityEngine.Material& mat, UnityEngine.Rendering.BlendOp op) [0x00011] in .\Library\PackageCache\com.coffee.softmask-for-ugui@c13e44dc66\Runtime\Utilities\SoftMaskUtils.cs:143 at Coffee.UISoftMask.SoftMaskUtils.GetSoftMaskingMaterial (Coffee.UISoftMask.MaskingShape+MaskingMethod method) [0x00001] in .\Library\PackageCache\com.coffee.softmask-for-ugui@c13e44dc66\Runtime\Utilities\SoftMaskUtils.cs:131 at Coffee.UISoftMask.SoftMask.RenderSoftMaskBuffer (UnityEngine.Rendering.CommandBuffer cb, UnityEngine.Camera+MonoOrStereoscopicEye eye) [0x0018b] in .\Library\PackageCache\com.coffee.softmask-for-ugui@c13e44dc66\Runtime\SoftMask.cs:810 at Coffee.UISoftMask.SoftMask.RenderSoftMaskBuffer () [0x0022b] in .\Library\PackageCache\com.coffee.softmask-for-ugui@c13e44dc66\Runtime\SoftMask.cs:740 at Coffee.UISoftMaskInternal.FastAction+<>c.b__0_0 (System.Action action) [0x00000] in .\Library\PackageCache\com.coffee.softmask-for-ugui@c13e44dc66\Runtime\Internal\Utilities\FastAction.cs:85 at Coffee.UISoftMaskInternal.FastActionBase`1[T].Invoke (System.Action`1[T] callback) [0x00011] in .\Library\PackageCache\com.coffee.softmask-for-ugui@c13e44dc66\Runtime\Internal\Utilities\FastAction.cs:58 UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) Coffee.UISoftMaskInternal.FastActionBase`1:Invoke(Action`1) (at .\Library\PackageCache\com.coffee.softmask-for-ugui@c13e44dc66\Runtime\Internal\Utilities\FastAction.cs:62) Coffee.UISoftMaskInternal.FastAction:Invoke() (at .\Library\PackageCache\com.coffee.softmask-for-ugui@c13e44dc66\Runtime\Internal\Utilities\FastAction.cs:85) Coffee.UISoftMaskInternal.UIExtraCallbacks:OnAfterCanvasRebuild() (at .\Library\PackageCache\com.coffee.softmask-for-ugui@c13e44dc66\Runtime\Internal\Utilities\UIExtraCallbacks.cs:89) UnityEngine.Canvas:SendWillRenderCanvases() (at C:\build\output\unity\unity\Modules\UI\ScriptBindings\UICanvas.bindings.cs:104) (Filename: C:/build/output/unity/unity/Runtime/Export/Shaders/Material.bindings.cs Line: 18)

I initially thought that the hidden SoftMask shaders for the TMP was not getting included in the build. But even after adding them to the 'always include shaders list' in the 'Project Settings/Graphics' options the problem persists.

1. how it looks in the windows build:

Screenshot 2024-07-24 222516

2. how it looks in the unity player:

TMP SoftMask windows build problem (1)

3. always include shaders list:

TMP SoftMask windows build problem (2)

mob-sakai commented 1 month ago

Thank you for your reporting! Tell me about your develop/build environment.

Could you please attach a minimal project (included Assets, Packages and ProjectSettings directories) that reproduces the issue?

repos

jewelvjohn commented 1 month ago

Thank you for replying quickly. Here is the build info,

SoftMask version: 2.0.0 Platform: Standalone Windows Unity version: 2022.3.14f1 Build options: Mono, .NET Standard 2.1, Build-in RP

Project File

The project zip file is around 300MB, so I uploaded it to my mediafire & google drive accounts.

These are the links: MediaFire Google Drive

Build Settings

Screenshot 2024-07-25 093900

mob-sakai commented 1 month ago

Please try Project Settings > UI > Soft Mask > Included Shaders > Reset

image
mob-sakai commented 1 month ago

The issue is reproduced on my environment. I created a new issue: #178 It will be fixed in v2.1.2.

Hasty workaround: Project Settings > UI > Soft Mask > Included Shaders > Reset and save project.

github-actions[bot] commented 1 week ago

:tada: This issue has been resolved in version 3.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: