renanse

I'd like to import a spine model one time and use it to create 2 different prefabs, each with its own material.

For example, maybe one version using the normal spine shader and another version using a different shader with a different blend mode. I am unable to change the material however without disabling the SkeletonAnimation component as it simply sets the material back to the original one.

Is there any way to accomplish this (aside from duplicating the spine model and importing it a second time under another name)?
renanse
  • Postovi: 4

Nate

See SkeletonRenderer.cs line 246. The material comes from the attachment's renderer object, which the renderer expects to be an AtlasRegion. Attachments are shared across skeleton instances, so the materials are also. This is for dynamic batching. Eg, if you draw X of the same skeleton, it would be 1 draw call with the same material and X draw calls if they each had their own material.

You could customize the attachments so they have an AtlasRegion for a different material. Or you could customize SkeletonRenderer.cs so it uses the material you want.
Avatar
Nate

Nate
  • Postovi: 12020

renanse

Thanks that makes sense. :)
renanse
  • Postovi: 4


Natrag na Unity