- Изменено
[ Outline Bool ] How to Enable\Disable at runtime ?
update
I went with materialOverride.. this is more performant right? :upsidedown:
if (_color == 0) { _skeletonRenderer.CustomMaterialOverride.Remove(_materialDefault); }
if (_color == 1) { _skeletonRenderer.CustomMaterialOverride[_materialDefault] = _materialPhase; }
update end
Hi guys
I have a question.
As the subject asks, how can I enable\disable the BOOL for outlines during runtime?
I tried looking through the shader, but don't see a boolean for the outline. :think:
I notice that turning it on in the inspector, actually changes the material. I wonder how this would affect performance. Would we be instancing a new material each time the outline is enabled \ disabled?
IndieDoroid написалAs the subject asks, how can I enable\disable the BOOL for outlines during runtime?
I tried looking through the shader, but don't see a boolean for the outline. :think:I notice that turning it on in the inspector, actually changes the material. I wonder how this would affect performance. Would we be instancing a new material each time the outline is enabled \ disabled?
Please don't analyze and reproduce what the Inspector code does. There is an example scene Spine Examples/Other Examples/Outline Shaders
which demonstrates how you can use it at runtime.
The outline shader requires an additional pass, therefore it requires a different shader (or would be wasting an unnecessary empty pass when the outline is disabled when having both passes active all the time).
IndieDoroid написалI went with materialOverride.. this is more performant right?
That's why the example scene Spine Examples/Other Examples/Outline Shaders
does just that .
Harald написалIndieDoroid написалAs the subject asks, how can I enable\disable the BOOL for outlines during runtime?
I tried looking through the shader, but don't see a boolean for the outline. :think:I notice that turning it on in the inspector, actually changes the material. I wonder how this would affect performance. Would we be instancing a new material each time the outline is enabled \ disabled?
Please don't analyze and reproduce what the Inspector code does. There is an example scene
Spine Examples/Other Examples/Outline Shaders
which demonstrates how you can use it at runtime.The outline shader requires an additional pass, therefore it requires a different shader (or would be wasting an unnecessary empty pass when the outline is disabled when having both passes active all the time).
IndieDoroid написалI went with materialOverride.. this is more performant right?
That's why the example scene
Spine Examples/Other Examples/Outline Shaders
does just that.
Haha ok got it. Thanks for the confirmation Harald. :grinteeth:
Btw I'm dragging the materials in from the resource folder, is that ok? Or should I be making a game object for the scene? :think:
IndieDoroid написалBtw I'm dragging the materials in from the resource folder, is that ok? Or should I be making a game object for the scene?
Do you mean that you're not sure if it's ok to use an asset instead of a scene GameObject reference? If so: it's perfectly good to use asset references as Material Overrides, it's the normal way. Why do you think you would need to create a GameObejct instance? Or did I misunderstand your question?