Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Z-order flicking #5

Open
ArtturiSipila opened this issue Mar 21, 2014 · 3 comments
Open

Z-order flicking #5

ArtturiSipila opened this issue Mar 21, 2014 · 3 comments

Comments

@ArtturiSipila
Copy link

Z-order seems to be inconsistent in Unity. I tried importing the example asset "GreyGuy", in Spriter everything is working as expected. When testing the character in Unity with provided walk animation (walking right) characters right hand goes over the head and behind the body at some frames.

This should probably be an separate issue but I also noticed that the walk cycle is jerking and not as smooth as in Spriter.

Thank you for this great tool!

@dval
Copy link

dval commented Feb 26, 2016

Yeah, this is still happening. It's because when spriter animations are imported, all sprites get set on the same layer. This is a known limitation of 2D in Unity. You can use the check box 'Apply Spriter Z Order', this gives a unique 'Order in Layer' to each element in the sprite, and stops the flickering.

However, it has the additional drawback of all sprites having like elements on same layers. i.e. All bodies on layer 0, all arms on layer 1, all heads on layer 2, etc. So, if your spawning a bunch of sprites, and they overlap in scene, the parts all get shuffled together.

I don't know anyway around this, except to use some kind of external 2D ordering manager.

If all our spriter characters on the same canvas, it would need to look at how many items are in each spriter animation, set a base order layer at least that many units apart for each character, then sort all the character elements on to layers starting from the base layer.

ex: we have a character with 12 parts.

character 1 would have base 1, and occupy Order Layers 1-12.

character 2 would need to have a base of 13, and occupy Order Layers 13-25.

If each spriter character could be on its own canvas, than the manager would need to count characters and adjust the canvas order appropriately.

Also, not sure if building something like this into the importer is necessary, as it really depends on workflow. But, it seems like there should be something that manages all the EntityRenderers, similarly to how a canvas can manage all of its child sprites.

@Dharengo
Copy link

I implemented it very hastily to fix a more important problem. That said, if you set the order-in-layer on the main entity renderer it should change all the subsprites accordingly.

If you don't feel like counting sprites, just add 50 to each sprite you place.

Op 26 feb. 2016, om 01:01 heeft Dylan Valentine [email protected] het volgende geschreven:

Yeah, this is still happening. It's because when spriter animations are imported, all sprites get set on the same layer. This is a known limitation of 2D in Unity. You can use the check box 'Apply Spriter Z Order', this gives a unique 'Order in Layer' to each element in the sprite, and stops the flickering.

However, it has the additional drawback of all sprites having like elements on same layers. i.e. All bodies on layer 0, all arms on layer 1, all heads on layer 2, etc. So, if your spawning a bunch of sprites, and they overlap in scene, the parts all get shuffled together.

I don't know anyway around this, except to use some kind of external 2D ordering manager.

If all our spriter characters on the same canvas, it would need to look at how many items are in each spriter animation, set a base order layer at least that many units apart for each character, then sort all the character elements on to layers starting from the base layer.

ex: we have a character with 12 parts.

character 1 would have base 1, and occupy Order Layers 1-12.

character 2 would need to have a base of 13, and occupy Order Layers 13-25.

If each spriter character could be on its own canvas, than the manager would need to count characters and adjust the canvas order appropriately.

Also, not sure if building something like this into the importer is necessary, as it really depends on workflow. But, it seems like there should be something that manages all the EntityRenderers, similarly to how a canvas can manage all of its child sprites.


Reply to this email directly or view it on GitHub #5 (comment).

@dval
Copy link

dval commented Feb 26, 2016

I implemented it very hastily

I just found a post on brashmonkey forums that links to your repo. The intro to spriter, links to mythgarr's repo. He states in an issue comment, that bonus2113's repo is probably more up to date. And then, I found @Dharengo 's repo which is way more current than both of those. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants