DarkTI

Is it possible to use MaterialPropertyBlock for spine materials? Specifically for materials assigned via CustomSlotMaterials?

And if yes, then how? Normally I'd did something like GetComponent<SpriteRenderer>().SetPropertyBlock(block), but I'm not sure which renderer I am supposed to access in case of spine.
User avatar
DarkTI
  • Posts: 36

Misaki

Please refer to the "Changing Materials Per Instance" section of the spine-unity documentation, which includes a description of MaterialPropertyBlocks if you have not read this:
spine-unity Runtime Documentation: Changing Materials Per Instance
User avatar
Misaki

Misaki
  • Posts: 1164

DarkTI

Thanks, but I'm afraid the article doesn't contain all answers to my question. Which I found out after additional research.

One needs to use GetComponent<MeshRenderer>().SetPropertyBlock(block, index), where index is the index of the material in the list of meshrenderer materials visible in unity inspector at runtime after assigning CustomSlotMaterials.
User avatar
DarkTI
  • Posts: 36

Harald

Your observation is correct. Please note that the required submesh count and order (and thus the material order) may change when you change e.g. attachment visibility or draw order.
User avatar
Harald

Harri
  • Posts: 4459


Return to Unity