Legacy Documentation: Version 4.6(go to latest)
Language: English
  • C#
  • JS
  • Boo

Script language

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

Animation.wrapMode

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

Switch to Manual
public var wrapMode: WrapMode;
public WrapMode wrapMode;
public wrapMode as WrapMode

Description

How should time beyond the playback range of the clip be treated?

WrapMode.Default: Read's the wrap mode from the clip (default for a clip is Once).
WrapMode.Once: Stops the animation when time reaches the end.
WrapMode.Loop: Starts at the beginning when time reaches the end.
WrapMode.PingPong: Ping Pong's back and forth between beginning and end.
WrapMode.ClampForever: Plays back the animation. When it reaches the end, it will keep sampling the last frame.

	// Make the animation loop
	animation.wrapMode = WrapMode.Loop;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        animation.wrapMode = WrapMode.Loop;
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		animation.wrapMode = WrapMode.Loop