We’re having some problems with rendering objects on different layers. Currently, we’ve only made use of the Z-position of each object but we’ve found a specific problem now.
Here we have a tree/wall with a rotation at 0 placed BEHIND the grass. The sprite component of the tree has a Z-pos of -1 and the grass at 0. http://i.imgur.com/mdNRWOt.png
But changing the Y-rotation to -180 (for a mirrored look/flip the sprite horizontally) puts the tree IN FRONT of the grass, as if the sprite has some depth - that we can’t modify. http://i.imgur.com/Ofgt3sE.png
So, we’re wondering what the best way to get around this is, what the optimal way of setting rendering layers is.
Have you placed the sprite at -1 inside the game object? If so, the sprite’s position is set relative to the game object, so when you rotate the game object 180 degrees the sprite ends up at Z position 1.
The solution is simple. Just set the sprite component’s position to 0 and the game object’s to -1. That way the sprite won’t move along the Z axis when the game object rotates.
You can put the game object in a collection (it’s sort of a prefab) and place those into the game. That way you can easily change all instances at any point.