Kronnect

Even more splendid assets! => Highlight Plus => Topic started by: mightyboosh on February 10, 2021, 09:11:54 PM

Title: 2D outline not updating when using Unity's SpriteSkin 2D animation component
Post by: mightyboosh on February 10, 2021, 09:11:54 PM
Hi,

I've been trying to use the HighlightEffect2D component in my 2D Unity game to outline sprites. I have created bone structures using Unity's Skinning Editor and generated the bone hierarchy in the scene using Unity's SpriteSkin component. The 2D characters movements are animated by changing the bone game objects' transforms. My problem is that the outline being generated by HighlightEffect2D doesn't update as these animations play and the sprite skin geometry is deformed.

I have tried calling Refresh() and UpdateMaterialProperties() within the Update() loop which didn't work.

Please help me understand how to get this working.

Thanks.
Title: Re: 2D outline not updating when using Unity's SpriteSkin 2D animation component
Post by: Kronnect on February 11, 2021, 05:58:28 PM
Hello,

Could you please send me a scene to contact (at) kronnect.com with just one of those animated sprites?  I'll take a look into it.

Thank you.
Title: Re: 2D outline not updating when using Unity's SpriteSkin 2D animation component
Post by: mightyboosh on February 12, 2021, 06:47:07 PM
Hello,

Could you please send me a scene to contact (at) kronnect.com with just one of those animated sprites?  I'll take a look into it.

Thank you.

Sent, thanks!
Title: Re: 2D outline not updating when using Unity's SpriteSkin 2D animation component
Post by: Brogan on April 19, 2021, 05:15:19 AM
Hi there I actually managed to get this working. After looking at the HighlightEffect2D.cs script I realised that it was caching a reference to the SpriteSkin on the gameObject and wasn't respecting the "Children" Include field.
I solved this by adding a HighlightEffect2D script to each body part (for me was just Head, Torso, Arms, Legs) then setting Include to "ObjectOnly" and it works fine now.

Only downside is you need to select all the gameObjects to make adjustments otherwise you're only adjusting that single body part. This is not an ideal workflow, but at least it works as expected now.
I did try modify the HighlightEffect2D script to store the SpriteSkin as an array but it did quite work out for me. I don't know the code well enough to try make that work. If I do I'll post it here.
Title: Re: 2D outline not updating when using Unity's SpriteSkin 2D animation component
Post by: Kronnect on April 19, 2021, 09:13:41 AM
Hi,

Please use latest beta which now allows multiple sprite skin components (so you can use Include and attach the component just to the root of the group).

Regards