I'm using a simple custom shader to tint a spine model. Then I use the code below to set a property of it.
It works for SpriteRenderers, but not on the MeshRenderer that spine uses.
The shader inspector says "MaterialPropertyBlock is used to modify these values", on the SpriteRenderer. Not sure if that makes any difference. Or isn't this supported? If so, how can I change the shader on the Spine object?
private static readonly int _weight = Shader.PropertyToID("_weight");
// Doesn't change the material
// Changes the sprite renderer material
However, when i change the weight parameter of the shader's inspector on the object when the game is running, it changes.
Any ideas what's wrong here?
I found this code linked from a forum post about this topic:
And tried this code:
block = new MaterialPropertyBlock();
Debug.Log("block.GetFloat = " + block.GetFloat(_weight));
The debug outputs 1, but the image and the shader still remains unchanged..
Also the shader on the spine meshrenderer doesn't say "MaterialPropertyBlock is used to modify these values" like it does on SpriteRenderer which seem to indicate i'm doing something wrong...