Version: 2017.2
public Keyframe[] keys ;

Descripción

Todas las teclas definidas en la curva de animación.

This lets you clear, add or remove any keys from the array. If keys are not sorted by time, they will be automatically sorted on assignment.

Note that the array is "by value", i.e. getting keys returns a copy of all keys and setting keys copies them into the curve.

Mirar también: Funciones Keyframe struct, AddKey, RemoveKey.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { private AnimationCurve anim; private Keyframe[] ks; void Start() { ks = new Keyframe[50]; int i = 0; while (i < ks.Length) { ks[i] = new Keyframe(i, i * i); i++; } anim = new AnimationCurve(ks); } void Update() { transform.position = new Vector3(Time.time, anim.Evaluate(Time.time), 0); } }