How to synchronize Sorting Layers between two projects?

I have two Unity projects - the main one with the game, and the other for content loaded at runtime via Addressables. I recreated the main projects Sorting Layers in the second one, so that they are in the same order and named the same. When I load sprite renderers that were set up in the second project in the main one, they have set as the Sorting Layer. I’m guessing that the IDs mentioned here Unity - Scripting API: Renderer.sortingLayerID don’t match up between the projects. Is there any way I can force them to match?

I’ve never been able to figure this out smoothly. It’s annoying. I always just make a “SortingLayerInjection” script that has a string name field and jams it into the renderer at Awake() or Start() but it doesn’t really help you at editor time. It’s messy.

I suppose you COULD copy it over forcibly by hand-editing the TagManager.asset. But the prefab where it is used also tracks the index, so that would have to match:

NOTE: due to 32-bit 2’s complement, the value -336567667 is equal to 3958399629, the ID for slayer1

6945278--816701--Screen Shot 2021-03-17 at 9.31.45 AM.png

The actual usage of such a layer (in this case slayer1):

6945278--816704--Screen Shot 2021-03-17 at 9.31.49 AM.png

1 Like