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
1.97k stars 261 forks source link

ArgumentException: RenderTextureDesc width must be greater than zero. #104

Closed plyoung closed 3 years ago

plyoung commented 3 years ago

This error occurs when I load the project. The sprite does not appear until I click on it, click away, and click back (in hierarchy); or, I can press Play and the error will occur again but the sprite will then start showing and error stops from then on till next time i restart Unity with the project loaded. Unity 2020.2,0b2 though, so not sure if that is at fault here.

ArgumentException: RenderTextureDesc width must be greater than zero.
Parameter name: desc.width
UnityEngine.RenderTexture.ValidateRenderTextureDesc (UnityEngine.RenderTextureDescriptor desc) (at <9584de3444b542abbb1ad4bb43a7137f>:0)
UnityEngine.RenderTexture.GetTemporary (UnityEngine.RenderTextureDescriptor desc) (at <9584de3444b542abbb1ad4bb43a7137f>:0)
UnityEngine.RenderTexture.GetTemporaryImpl (System.Int32 width, System.Int32 height, System.Int32 depthBuffer, UnityEngine.Experimental.Rendering.GraphicsFormat format, System.Int32 antiAliasing, UnityEngine.RenderTextureMemoryless memorylessMode, UnityEngine.VRTextureUsage vrUsage, System.Boolean useDynamicScale) (at <9584de3444b542abbb1ad4bb43a7137f>:0)
UnityEngine.RenderTexture.GetTemporary (System.Int32 width, System.Int32 height, System.Int32 depthBuffer, UnityEngine.RenderTextureFormat format, UnityEngine.RenderTextureReadWrite readWrite, System.Int32 antiAliasing, UnityEngine.RenderTextureMemoryless memorylessMode) (at <9584de3444b542abbb1ad4bb43a7137f>:0)
Coffee.UISoftMask.SoftMask.get_softMaskBuffer () (at Library/PackageCache/com.coffee.softmask-for-ugui@1.0.0-preview.10/Scripts/SoftMask.cs:192)
Coffee.UISoftMask.SoftMaskable.<UnityEngine.UI.IMaterialModifier.GetModifiedMaterial>b__28_0 (UnityEngine.Material mat) (at Library/PackageCache/com.coffee.softmask-for-ugui@1.0.0-preview.10/Scripts/SoftMaskable.cs:135)
Coffee.UISoftMask.MaterialCache.Register (UnityEngine.Material material, UnityEngine.Hash128 hash, System.Action`1[T] onModify) (at Library/PackageCache/com.coffee.softmask-for-ugui@1.0.0-preview.10/Scripts/MaterialCache.cs:60)
Coffee.UISoftMask.SoftMaskable.UnityEngine.UI.IMaterialModifier.GetModifiedMaterial (UnityEngine.Material baseMaterial) (at Library/PackageCache/com.coffee.softmask-for-ugui@1.0.0-preview.10/Scripts/SoftMaskable.cs:129)
UnityEngine.UI.Graphic.get_materialForRendering () (at C:/Apps/Unity/2020.2.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Graphic.cs:492)
UnityEngine.UI.Graphic.UpdateMaterial () (at C:/Apps/Unity/2020.2.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Graphic.cs:645)
UnityEngine.UI.Image.UpdateMaterial () (at C:/Apps/Unity/2020.2.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Image.cs:900)
UnityEngine.UI.Graphic.Rebuild (UnityEngine.UI.CanvasUpdate update) (at C:/Apps/Unity/2020.2.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Graphic.cs:623)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/Apps/Unity/2020.2.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/CanvasUpdateRegistry.cs:217)
UnityEditor.Undo:Internal_CallWillFlushUndoRecord()
mob-sakai commented 3 years ago

@plyoung Thank you for your reporting!

mob-sakai commented 3 years ago

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

plyoung commented 3 years ago

I did a few more tests and it seems to happen only if Unity is oppened while the Scene view is active (when you exited before with Scene panel active). If you open the project with Game view active then the error will not occur. My Game and Scene panels are on different tabs so not both visible (active) at same time.

TEST.zip

mob-sakai commented 3 years ago

Thanks!

mob-sakai commented 3 years ago

@plyoung The issue is reproduced on my environment.

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 1.0.0-preview.11 :tada:

The release is available on:

Your semantic-release bot :package::rocket: