Hello AC users !
On some of my scenes, I have some complicated perspectives that I could not handle properly with SortingMaps (probably because I didn't understand all the possibilities of that functionnality). I handled the scaling and the ordering in layer with script and this is working quite well. Nevertheless, to get this working, I need to disable the Follow SortingMap script on the child of my Player.
Is there a way to it by code ? With that I could then test in which scene my player is, and enable/disable the script accordingly. I searched in the scripting-guide but could not find my answer.
Thanks in advance !
Pauline
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I'm sure there's probably a better way, but this works for me. Just add it to the Player Prefab's top level GameObject as a script called SetPlayerSortingMap, and then set "Sorting Map On" True, or False, in the Prefab's Inspector, as appropriate:
Thank you @HarryOminous , it works I used
playerSortingMap.enabled = sortingMapOn;
instead, so that the default sorting map is used when the script is enabled.
Have a nice day !
Unless your game makes use of the "player switching" feature, you can use an alternative Player without this component for such scenes.
When a local Player (i.e. a Player in the scene file itself) is found, it will override the default prefab (the one assigned in the Settings Manager) for the duration of that scene.
Thank you @ChrisIceBox , that is actually the solution I used before, but because I have a lot of scenes, I find it easier to have just one prefab handling everything and no alternative player in scenes. But maybe it's only a question of good practices (I am not very at ease with prefabs yet !)