Hey guys, I'm trying to figure something out regarding materials.

I have a day/night cycle in Unity, created with an animated directional light. Most of my Spine animations are using a Skeleton Lit material, so they work nicely with the day/night cycle.

However, I have a couple of animations that I'd like to have both lit and unlit elements. For example, a character holding a lantern. I would like the character overall to use a Skeleton Lit material so that they are affected by lights , but some sprites within the character (such as the lantern, the 'light glow' fx) to remain unlit. I want the affect to be that the character itself is affected by the day/night cycle, but it would obviously look weird if the glowing lantern was also being affected by lights.

Is there a way to have certain sprites in the atlas use a different material?

Thanks! :)
  • Сообщения: 4


Yes, there are multiple ways to assign different materials at certain slots.

If you want to specify custom Materials per skeleton instance or per slot, you can use SkeletonRenderer.CustomMaterialOverride via code or the component SkeletonRendererCustomMaterials.

Theoretically yet another alternative would be to use a SkeletonRenderSeparator to have two separate SkeletonRenderer objects where you can assign a different MateriaPropertyBlock, but it is just a possible option, not a good one :).
Аватара пользователя

  • Сообщения: 1054

Вернуться в Unity