Skip to main content

AnimationClip.SetCurve(string relativePath, userdata type, string propertyName, AnimationCurve curve)

Assigns the curve to animate a specific property.

Parameters:

NameTypeDescription
relativePathstringPath to the game object this curve applies to. The relativePath is formatted similar to a pathname, e.g. "root/spine/leftArm". If relativePath is empty it refers to the game object the animation clip is attached to.
typeuserdataThe class type of the component that is animated.
propertyNamestringThe name or path to the property being animated.
curveAnimationCurveThe animation curve.

Usage

---@type AnimationClip
local animationclip;

---@type string
local relativePath;

---@type userdata
local type;

---@type string
local propertyName;

---@type AnimationCurve
local curve;


animationclip.SetCurve(relativePath, type, propertyName, curve)

Extra Detail

If curve is null the curve will be removed. If a curve already exists for that property, it will be replaced. Note: SetCurve will only work at runtime for legacy animation clips. For non-legacy AnimationClips it is an editor-only function.