FadeIn/Out object composed of multiple sprites?
So I was making a basic RPG and all my tests until now were using simple sprites.
There are different circumstances when I need the characters to fade in and out in order to make the transitions look smooth, and it's working and looking just fine.
Now I started using Anima2D, so my characters are composed of multiple sprites, but I realized that when they FadeOut/In you can see through the hair, clothes, etc, and I really don't like how it's looking now.
Small example, you can see the legs behind the skirt during the transition.
And that's it. I want the fadein/out animation to look homogeneous, but I don't know how to approach this problem, so I'm looking for suggestions.
My first guess is that it's something a shader can help with, but since I don't really have experience working with shaders, I have noidea.
Answer by shaileshteli14 · Apr 14, 2020 at 03:04 AM
@TarasHalynskyi @WhispyWoods Hello, I do have a little solution but, I don't know if it would actually help you. The thing is, just add a sprite mask. In reference to the above chase, add a sprite mask component to the skirt, and add the skirt sprite into it. Then for legs, set the "Mask Interaction" option to "Visible outside the mask".So, that only the part of the legs which are not covered by the skirt will be visible. I haven't tried it but, it should work. Let me know if it works fine.
Yea it works man. Thanks. Implemented it just some $$anonymous$$utes before your answer =).
Answer by TarasHalynskyi · Apr 14, 2020 at 03:41 AM
Hi @WhispyWoods I have a solution for u.
Make the custom value of "Order in layer" for each part of your model. (What I think you already did). And make it "Visible outside the mask".
Add "Sprite Mask" to each part. Insert in mask same sprite as on part. Activate "Custome Range" and put Alpha Cuttof to 1 for each mask.
Put the same "Sorting Layer" of the front part of the range on your model parts (I think it should be the same on every part of the model) and "Order in Layer" for every "Sprite Mask". "Order in Layer" should be n - 1. Where n equals to "Order in Layer" of your part.
After this everything will work as u want. As for me, I have used runtime solution but it can be not efficient if u want to use many instances of prefab with this algorithm. If it's one model it is much better to make it once in the editor. Let me know if u will need a code of runtime solution.