Forum rules - please read before posting.

Sorting map overriding sorting order in animation?

edited October 2019 in Technical Q&A

Hey guys!

I've been trying to figure out a problem in AC for a little while now. It's a bit complex, but I'll try to explain: I have a player character which is composed of several body parts/limbs, and through an animation, I want to change the Order in Layer (in the Sprite Renderer) on one of the body parts (the body part should be appear in front of the player instead of the back). However I am not able to do so, as it seems as the sprite's Order in Layer has been locked to the value it was when the scene started.

The reason seems to be that I am currently using a Sorting Map that affects the sprite's Sorting Layer, and the Follow Sorting Map script is set to "Offset original Order" and "Also affect children", thus "locking" the Sprite Renderer's Order in Layer. Turning off "Also affect children" solves the problem with the Order in Layer (as the animation now is able to change the sprite's sorting order), but creates another issue, as the sprite's children aren't set to the correct Sorting Layers anymore.

I'm not sure how understandable this was :smile: But if anyone has encountered such a problem before, and found a good solution for it (other than having several sprite renderers with different sorting order for the same body part) I'd love to hear them!

Comments

  • I understand, but I was actually going to suggest having a separate sprite renderer for the body part before I read your last paragraph. If it's only for a few animations, it's not too bad a solution.

    The Sorting Map will take control of the Order In Layer field - but that's it's job. One other option to look into would be to give this sprite the same Order In Layer as the sprite(s) it moves in front of - and then use it's Z-position to move it closer and further away from the camera as required. IIRC, two sprites (as separate GameObjects) with the same sorting order will be rendered in order of distance to the camera.

  • Thank you for your quick answer, Chris! :smile: I will check out the Z-position solution. Otherwise, I think I can live with having several sprite renderers for a few sprites.

    Have a nice day!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.