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.91k stars 257 forks source link

[v1] NullReferenceException when adding SoftMask component #160

Closed CDTR-MattConroy closed 16 hours ago

CDTR-MattConroy commented 9 months ago

Describe the bug When adding a SoftMask component to an empty GameObject, NullReferenceExceptions are continuously thrown until a Graphic is also added.

To Reproduce Steps to reproduce the behavior:

  1. Create an empty GameObject
  2. Add a SoftMask component
  3. See error in console

Expected behavior No errors are thrown when adding a SoftMask component. Either a default Graphic should be added if required (during Reset or OnValidate), or ideally, handle missing Graphic components.

Environment (please complete the following information):

Additional context

NullReferenceException: Object reference not set to an instance of an object
Coffee.UISoftMask.SoftMask.UpdateMaskTextures () (at ./Library/PackageCache/com.coffee.softmask-for-ugui@1.0.2/Scripts/SoftMask.cs:476)
UnityEngine.Canvas.SendWillRenderCanvases () (at <836aea33117647b388cc5f48bed669c4>:0)
mob-sakai commented 16 hours ago

Please try v2: https://github.com/mob-sakai/SoftMaskForUGUI/releases/tag/v2.0.0