How can I set this through the inspector/scripting?
Every time I start a game it gets set to zero. While using the animation inspector it’s greyed out. What’s going on with this?
How can I set this through the inspector/scripting?
Every time I start a game it gets set to zero. While using the animation inspector it’s greyed out. What’s going on with this?
By script you can use
Animator.SetLayerWeight(int layerIndex, float weight)
When you start your game the weight of all layer are set to 0 by default except for the base layer which is 1
you can set it on startup like this
void Start ()
{
animator = GetComponent();
if(animator.layerCount >= 2)
animator.SetLayerWeight(1, 1);
}
In the editor the weight is grey out right now but in a future release we will like to use it to allow user to set a default value like parameter.
Sonny
Oops, missed a type:
Just a note on this, if you’re using any kind of pooling system for your animated characters you will be better off setting the weight in OnEnable instead of Start. It seems that any changes to layer weight are lost if the Animator is disabled.
this script attach to 3dmodel ?
what is the “Weight” value mean to layers?
Like transparency of the layer’s on photoshop but instead about animations