Legacy Documentation: Version 4.6.2
Language: English
  • C#
  • JS
  • Boo

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

AnimationMode.SampleAnimationClip

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function SampleAnimationClip(gameObject: GameObject, clip: AnimationClip, time: float): void;
public static void SampleAnimationClip(GameObject gameObject, AnimationClip clip, float time);
public static def SampleAnimationClip(gameObject as GameObject, clip as AnimationClip, time as float) as void

Description

Samples an AnimationClip on the object and also records any modified properties in AnimationMode.

This function must always be surrounded by AnimationMode.BeginSample and AnimationMode.EndSample. When a property is no longer sampled (through SampleAnimationClip or AddPropertyModification) between BeginSample and EndSample it will automatically revert to the original value when EndSample is called.

AnimationMode.BeginSample ();
AnimationMode.SampleAnimationClip (gameObject, clip, 0.3F);
AnimationMode.EndSample ();