Page 1 of 1

Sprite rect transform

PostPosted: Thu Apr 19, 2018 10:17 am
by aroig_gsn
Hey there! me once again

I was wondering, is there a way to access a sprite's rect transform from a node or something? Its because we're using a UI shader to project a second texture on each sprite (color dodge blend mode for shining effects). And it works perfectly until you pack the UI sprites on atlases, then the second texture ends up being projected on top of the whole atlas, not each individual sprite.

Any workaround?

thanks!

Re: Sprite rect transform

PostPosted: Thu Apr 19, 2018 11:05 am
by Amplify_Borba
Hey there!

Apologies but I'm not sure I fully understand what you're trying to achieve, would it be possible for you to send us a sample project with the issue present in order for me to best help you? Feel free to send it via [email protected], thanks!

Re: Sprite rect transform

PostPosted: Fri Apr 20, 2018 9:59 am
by aroig_gsn
Just sent it ! Thank you for your assistance!

Re: Sprite rect transform

PostPosted: Fri Apr 20, 2018 3:20 pm
by Ricardo Teixeira
aroig_gsn wrote:Just sent it ! Thank you for your assistance!


Thank you for the sample, we really appreciate it.

Unfortunately, due to the way Unity handles this type of specific use, you'll have to use an additional script to properly overlay the numbered texture. We actually included a sample that you can use as a starting point, be sure to check the SpritesMask scene.

I took the liberty of adjusting your sample, please check the attached file.

You'll have to pass and adjust a custom set of UV's using the script included(copy>pasted the node network from our sample); the included script must also be added to the asset using it.

Image

Be sure to press Play if the effect is not initially displayed correctly.


Thanks!