Forum rules - please read before posting.

Follow default sorting map? resets after loading a savegame

Hi!
I'm having an issue with Sorting Maps in my 2D game, specifically with the "Follow default sorting map?" setting in NPCs.
My project is a side-scrolling game, where all characters follow predefined paths with a fixed sorting order, walking along a strict horizontal line. Some NPCs start behind the player (a dog) and move forward, changing their Sorting Map at a certain point (which I’ve handled using a "Change Rendering Map" action inside the corresponding path node).
For all my NPCs, I have disabled "Follow default sorting map?", as I want to manually control which Sorting Map they are in.

https://drive.google.com/file/d/1uhDfnGcnPJAu7sParSZv8j2rEegBHBEn/view?usp=drive_link

Everything worked fine, but I’ve realized that when loading a saved game, my setup breaks and NPCs appear in the wrong sorting layer.

Apparently, when loading the "Follow default sorting map?" checkbox automatically reactivates, causing characters to appear on the wrong Sorting Layer.

Here’s my project setup and configuration:

  • All NPCs have the Remember NPC component, and all paths have a Constant ID.
  • This issue only happens with NPCs following a path. If an NPC is static and does not move, the setting remains unchanged after loading. However, all NPCs attached to a path have their "Follow default sorting map?" option reset to ON upon loading.

https://drive.google.com/file/d/1za_uYXMHzXp8aWDUq_HjfF6bpaVDtVml/view?usp=drive_link

What I’ve tried:

  • Toggling all available options in the Sorting Map settings (both enabling and disabling them).
  • Removing the Sorting Map from the scene entirely.
  • Removing the "Follow sorting map" component entirely from the NPC.
    None of these attempts have made any difference. Everything works fine until I load a save.

This is my first time working with "Follow default sorting map" in Adventure Creator, so I might be missing something.
Am I forgetting a "Remember" component or "Constant ID" to make sure this setting remains stable after loading? Or is my overall approach incorrect?

I’m attaching a short video showing how my NPC’s Sorting Map mode changes when loading a save, causing the character to appear in the wrong position within the scene: https://drive.google.com/file/d/10V6mZUpNARRKurFHVK9EYaehishAJpQ-/view?usp=sharing

Versions:
Unity: 2022.3.49F1
Adventure Creator: 1.81.7
Thanks in advance for any help! 😊

Comments

  • The links are all "access denied" - can you make them public?

    For AC to save which sorting map is active, however, yes - a Constant ID component will need to be attached to it. This can be automated via the top of the Settings Manager.

  • edited February 27

    Oh, sorry!! I have updated the links to make them public.

    I have now added a Constant ID to my Sorting Map, but the problem persists. I have noticed a very small change, though—now my NPC character appears in a background sorting layer upon loading. Before adding the Constant ID to the Sorting Map, my NPC would always appear in a frontal sorting layer upon loading.

    However, when I check the Inspector for that NPC, the "Follow default sorting map?" checkbox still changes from Off to On when loading.

    I have also try to use the "Auto add Save components to GameObjects" in the settings tab, but still not working.

    What I need is for the NPC to be fixed in a background Sorting Layer for a section of the path and then move it to a frontal sorting layer in another section of the same path. To achieve this, I added a node in the path with a "Character: Change Rendering" action.

    https://drive.google.com/file/d/1tpHkLp-8AXyw2z8WpTcSi10hV1E6Iz-U/view?usp=drive_link

    In the end, the issue remains because I need these character not to follow any Sorting Map (I assume) so that I can manually choose which sorting layer the character is in.

  • I think I have resolved the issue. The key was what you said about attaching a Constant ID to the Sorting Map.
    I tried so many combinations that it took me a while to recreate all of them with the Constant ID in place _: )

    Finally, I created a new Sorting Map with all properties set to Off, so it should not affect character sorting, size, or speed. I assigned this Sorting Map to my NPC.

    When I play the game, everything works fine. However, when I load a savegame, the layers still get messed up.

    But this time, the Inspector on Play does not seem to have changed or reverted my configuration—everything still looks correct in the NPC’s Inspector.

    With this part solved, I have introduced some Variables to check the NPC’s position on load and correct it if necessary using a variable check.

    I need to conduct more testing, but it seems to be working.

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.