Forum rules - please read before posting.

URP and AC Sorting Layer

Unless I overlooked something, sharing this in case it might be useful to anyone else.

Drove myself bonkers trying to figure out why my character wasn't correctly walking in front and behind objects. I had a sorting layer and tried various settings on it.

I could assign 'Follow Sorting Map' to objects and then the player would move in front and behind objects as intended. However, I couldn't teleport those objects offscreen if 'Follow Sorting Map' component was active on them.

Tried various settings for the sorting layer, making sure my objects and character had their pivots set to the bottom and their pivots and not centers were being referenced...

I changed the Graphics custom sorting axis to 0,1,0 but I think that's only for built-in render pipeline. The 2D Primer shows how to do this for built-in render pipeline I think.

Only when I removed URP (Universal Render-Pipeline) from my project's graphic settings / project and set the sorting layer to 'affect sprite's: sorting layer' did I manage to get success. So, I'm not sure URP works with AC sorting layers too well?

I did notice that there's an info box in the Manual that if you're using URP, there's a Wiki script that one should copy and paste, not sure if this is solely for 2.5D or would work for the 2D game as well.

Anyways, if starting a new game, maybe a good idea to choose Built-In Render Pipeline?

Comments

  • edited September 28

    You were on the right track - users are encouraged to rely on a custom Sort Axis of 0,1,0 rather than using the Sorting Map to change sprite Order In Layer values.

    The only difference with URP is that it's not in the Graphics settings, but in the Inspector of the URP asset itself.

    The 2D Primer was recently updated, and demos how to change this value for a URP project here.

    A text tutorial on this topic can also be found here.

  • Hi Chris - thanks, I did watch the new tutorial, and edited the URP asset itself in the inspector as demonstrated. I think the sorting worked as long as the player's scale didn't go above 100% (scale being decided by the sorting layer's two min/max scale settings), but if he went above 100%, he'd appear in front of the object that he should have been behind. But when removing URP, that seemed to solve the issue.

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.