Hi,
I have now created my player and NPC's using a kind of mechanism approach. were each part of the character is a separate child of a main child within the root object with a separate sorting number (see link to screenshot). However, I am running into frustration where certain rooms objects interfere with the layers within the characters layers (see link to screenshot), is there a way to stop this? And have the root object have a specific sorting layer that tits child objects don't interferer with etc?
Thanks
Comments
As you have Offset original order? checked in your FollowSortingMap component, you should find that e.g. "Head" always has an order of 2 greater than "Garland". You will need to make sure, then, that the layer numbers in your SortingMap are spread out wide enough to encompass the offsets.
Screenshots and videos are helpful, but context is always needed - please explain as clearly as you can what exactly the problem is.
The relative order between the child objects shouldn't be affected - though I think I was wrong about unchecking Also affect children? - you want that on so that all sprites are placed on the same layer (but still have different orders within that layer). And Offset original order should be off, I believe.
The layer names I gave were just examples - the principle's stil the same as numbers, only you're using names instead. You could even name your layers as numbers, e.g. "1", "2", etc.
Your sofa example is exactly what SortingMaps are for - once you've set it up correctly, that's how it'll behave.
For a simple room with a sofa in the middle, you could use something like:
Background (Assigned to a scene sprite)
->
MidBackground (On the sorting map, so assigned automatically to characters)
->
Sofa (Assigned to a scene sprite)
->
MidForeground (On the sorting map, so assigned automatically to characters)
->
Foreground (Assigned to a scene sprite, if appropriate)
The reason I suggested using number strings instead of e.g. "Sofa" is so that you can intuitively re-use them for different scenes.
Whether you use the Layer Name or Order Number to control your Sorting Map, the principle is the same. The Sorting Map will change the layer/order or any sprite that has a Follow Sorting Map component according to their position in the scene. Sprites that do not have a FSM will not be affected. You can open up the 2D Demo scene to see how multiple stationary objects are placed in a scene so that the Player can move around them.