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] How to detach and reattach children at runtime? #136

Closed nukedpenguin closed 13 hours ago

nukedpenguin commented 2 years ago

I have a few circular soft masks stacked in a hierarchy, and the lowest child is a black square, I want to detach the children to rescale parent objects and reattach to preserve the scale and position of the children. What happens is the script seems to stop rendering after I have reattached the children.

What's interesting is that I can start the game without those objects being nested, but attach the parents in the hierarchy, then it will render properly. But detaching them totally stops the rendering even after reattaching.

Is there a way to force the script to render after this?

Also, is there a way to add these soft mask scripts dynamically to new objects in the game?

EDIT: I think that instead of detaching the children, I can set the parent to an inactive dummy game object.

mob-sakai commented 13 hours ago

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