When I move the player in front of an NPC using ActionCharPathFind, the player ends up with a Z pos that correctly renders the player in front of the NPC (given that they both are following the same sorting map). But if I instead teleport the player using ActionTeleport (to the same marker), he ends up standing behind the NPC.
AC: 1.72.4
Unity: 2020.1.17
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Are they both in the same region of the sorting map?
When two characters are in the same area, they will have the same Sorting Order. Their Z-positions will be altered slightly to make sure they're drawn in the correct order.
I need to know if this is a case of that not happening when it should.
They are both in the same region.
There's not enough detail for me to recreate any such issue. Can you PM a repro?
I found out the reason for the broken ordering: It's because the Hotspot marker I teleport the player to is defined inside the prefab of the NPC (and under the Sprite game object). So when the position was copied it took into account the z pos of the sprite game object parent. If I avoid having it as a child of the Sprite it works.
No worries, I'll set up a validation rule for this.