So when I load/drag and drop a prefab NPC while the game is running, the Follow Sorting Map doesn't work/makes no changes to the scale etc. of the character.
The sorting map does work if the game isn't running and I just drop an NPC into the edit window and move it around. Also, it works if the character is saved in the scene, but that's not going to work for what I'm trying to make. I need to be able to load character prefabs into the scene and have them use the sorting map.
Note: I'm not using AC to load the prefabs. It's a different script. But this used to work on previous versions. I could just load a prefab with all the relevant NPC and Follow Sorting Map scripts into a scene and it would automatically follow the sorting map.
Note 2: Yes, I tested a clean install of AC into an empty Unity project and it still doesn't work.
Note 3: Yes, I tried different object arrangements for the Follow Sorting Map script. ie: putting it on the root object and checking off "Also Effect Children" and having the sprite on a child object etc etc.
Any thoughts?
Comments
Please see the front page of the scripting guide: AC handles all updates to its own objects via the StateHandler. Therefore, the StateHandler's internal record of scene objects must be updated whenever an object is added from a separate script:
AC.KickStarter.stateHandler.GatherObjects ();
But is this a change from older versions? In old versions when I would drag or add an object with a FSM component on it, it would just work automatically.
Is there a way to automate this without scripting? (which I'm not very well versed in)
Basically I'm using AC with Ork Framework and I need to use Ork to load the prefab, but I need AC to recognize the prefab. Is there maybe an action I can put on the NPC that will tell AC "Hey, I'm in the scene, recognize me."
If you have access to the script that's performing the addition, you just need to insert the line above into it once the prefab has been run.
The way to automate it without scripting is to use the Object: Add or remove Action - which is intended for those who want to avoid coding altogether. One option would be to create an ActionList asset that has this single Action alone, and then run the ActionList manually by running its Interact() function.
Honestly it worked until Unity 5.6 and AC 1.56
Maybe it was because I always had "Edit Mode Preview" checked and it would work whether in the edit window or the game window even if the game was running.
Now it still works in edit mode, but not when the game is running. I'm guessing it's something different about Unity 5.6.
Thanks again.