3
\$\begingroup\$

I have a simple game scene where i have put a number of images. I combined these images into layers (SortinLayer, to be specific). So now I have 3 layers. I have read a few tutorials, but in them was described how to make parallax effect for the certain bitmap, not for a group of images that were grouped under one layer. But I need to make a parallax effect for the whole layer. Is it possible to do this in Unity2D?

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

In unity, SortingLayers (or camera layers for that matter) are not groups of object you should see them as tags :

specifically for the sprites, sorting layers are used to define the order of render of the objects. you can go through all the sprite-renderers and check their layers and apply something to their transforms but that will consume "a lot"* of resources.

better solution is to really group your objects by parenting them to the same transform, and then you move that transform.

For ex : 30 objects and you want to make three "layers" (but once again it is parallax layers not sorting layers (they can be related (you want stuff to be drawn in order) but are not the same thing))

what you would do in that case if create three empty game objects and drag 10 object onto each of them, then you'd move those 3 game objects according to the camera to achieve the parallax effect

  • "a lot" does not mean gigantic amounts (while that depends on the number of sprites you go through...) but it means that this is not the best approach
\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .