Setting Material Tag at runtime for replacement shader tricks

Hello, Does anyone know how to set a Material's Tag at runtime?

With this code, I can determine the value of a tag at runtime:

var materialTag = "RenderType";
var result : String = renderer.material.GetTag(materialTag, true, "Nothing");

Unfortunately, there is no Material.SetTag() function. Are there any other ways to set the tag of a material at runtime? (Other than changing the material's shader through scripting.) This could be very useful when dealing with replacement shaders.


“Will set a tag/value on the material that overrides the value of said tag from the shader.”

 material.SetOverrideTag("TagKey", "NewTagValue");

@Kovenant According to the docs It looks like you could use this to set any standard shaders “RenderType” tag.

While you can use this to allow objects with existing materials to be rendered selectively, It doesn’t look like its possible to do a replacement with dynamic values on both sides, since you pass a Shader, not a Material to the respective replacement functions.