I have been trying to create modifications in the shader in real time during an animation, what would be the best approximation to achieve this? The fact is that I use a series of preconfigured shaders of an asset, is it necessary to make the creation of each parameter that is modifiable in the material? or is there any other way? Also, I must say that I have tried to change parameters in my shader from Material ibrary(creating parameters), but this only apply in edit mode, in play mode do not happen anything. Thanks in advance.
top of page
bottom of page
Hi!
One of the most effective ways to change a material's properties while the animation is playing is writing a script.
In the page below, you can find the functions for the properties of the material.
https://rainyrizzle.github.io/en/Script/SC_Mesh.html
In particular, if you want to change the properties of a material at a specific point in the animation, using "Animation Events" will be effective.
https://rainyrizzle.github.io/en/AdvancedManual/AD_AnimationEvents.html
AnyPortrait does not support the method you suggested, "replace with preconfigured Shaders or Materials".
AnyPortrait manages the meshes' Materials internally to reduce Drawcalls.
They are integrated or separated in run-time by optimization rules.
If the user assigns a material arbitrarily by referring to "MeshRenderer.material" or changes the Shader arbitrarily, AnyPortrait's internal system does not work properly.
Please take note of this.
It doesn't make sense to us that the parameters of the Material Library work in edit mode but not in play mode.
Basically, once you've verified that it's set up properly in edit mode, it should be the same in the play mode.
If not, please check whether the material has been arbitrarily changed as mentioned above.
The pages below related to this answer will also be helpful.
https://rainyrizzle.github.io/en/AdvancedManual/AD_CharacterCostume.html
https://rainyrizzle.github.io/en/AdvancedManual/AD_ReduceDrawCalls.html
If you need additional answers, please leave a comment.
Thank you