Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/linjf520/article/details/90675949
Code
using UnityEngine;
public class ReadAnimCurves : MonoBehaviour
{
public bool appliedScaleCurve;
private Animator animator;
// Start is called before the first frame update
void Start()
{
animator = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
if (appliedScaleCurve)
{
var s = animator.GetFloat("scale");
transform.localScale = new Vector3(s, s, s);
}
else
{
transform.localScale = Vector3.one;
}
}
}
Is added to the state machine parameters: float scale = 1
fbx corresponding animation again, Curves Animation below the corresponding value of the control curve to add animation to the scale
Runtime
Normal running animation, do not use scale value curve
Application of scale effect curve values controlling the operation of localScale