Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


legacy

Set to true if the AnimationClip will be used with the Legacy Animation component ( instead of the Animator ).
Read time 1 minuteLast updated 11 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.AnimationModule
public bool legacy { get; set; }

Examples

// Create a new MonoBehaviour in your project and paste in the following code.using UnityEngine;// The example creates a new MonoBehaviour that is used alongside a Camera component.// At runtime, the component will create a procedural clip to animate the Camera field of view// property and automatically play that clip on an Animation component.[RequireComponent(typeof(Camera))]public class ProceduralFieldOfViewAnimation : MonoBehaviour{ void OnEnable() { AnimationClip clip = new AnimationClip(); AnimationCurve curve = AnimationCurve.Linear(0.0f, 60.0f, 10.0f, 90.0f); clip.SetCurve("", typeof(Camera), "field of view", curve); clip.legacy = true; if (!TryGetComponent<Animation>(out var animation)) animation = gameObject.AddComponent<Animation>(); animation.AddClip(clip, "animfov"); animation.Play("animfov"); }}