• Unity
  • Change SortingOrder and OrderInLayer during runtime

  • Modifié
Related Discussions
...

The SortingOrder and OrderInLayer appear to be exposed as public variable in the inspector for the SkeletonAnimation script. However, I cannot manage to access them via any code pulling in the SkeletonAnimation component.

Image supprimée en raison de l'absence de support de HTTPS. | Afficher quand même

Does anyone know how to access these in script? I need to change both during runtime for my game.

Those items in the inspector are purely shortcuts to the MeshRenderer's sorting properties.
Just change MeshRenderer's sorting layer and sorting order in code.

Despite being hidden in the inspector, those values are also serialized as part of MeshRenderer's object, not SkeletonAnimation.