blackvoyagegames

Hello Spine!

I am using 4.1 and the Spine/Sprite/Vertex Lit and want to be able to toggle on/off the outline using code. I can't find any documentation on which specific shader property to modify. OutlineWidth doesn't seem to do anything on its own, and there is no boolean. How can I toggle the outline like I would a boolean?
blackvoyagegames
  • Posts: 3

Misaki

Welcome to the Spine forum!

You can switch the visibility of outlines by preparing a material with enabling outline and a material disabling outline and overriding the applied material of the skeleton. An example scene Spine Examples/Other Examples/Outline Shaders demonstrates it and would be helpful.
User avatar
Misaki

Misaki
  • Posts: 1164

Harald

blackvoyagegames wrote: I can't find any documentation on which specific shader property to modify. OutlineWidth doesn't seem to do anything on its own, and there is no boolean. How can I toggle the outline like I would a boolean?
The reason why changing a bool property does not work is due to the fact that the Spine shaders use a custom UI which essentially switches to a different shader. E.g. when enabling Outline at a material using the shader Spine/Skeleton will be changed to Spine/Outline/Skeleton.

If you are interested in why that is necessary: the outline shaders require an additional pass, while parameters cannot be used to enable or disable shader passes, they can only be used to enable or disable #ifdef code branches within a pass.
User avatar
Harald

Harri
  • Posts: 4459


Return to Unity