---
tags:
    - "Timeline"
    - "Cutscene"
    - "Cinematic"
    - "Sequence"
    - "Loop"
    - "Hold"
    - "Extrapolation"
---

# Set Playable Director Wrap Mode

[Timeline](../index.md) / [Playable Director](index.md) / **Set Playable Director Wrap Mode**

## Description

Changes what the Playable Director does when it reaches the end of its Playable Asset

## Parameters

| Name | Description |
| :--- | :---------- |
| Playable Director | The Playable Director component changed |
| Wrap Mode | Hold keeps the last frame, Loop starts over and None stops |

## Code

```cs
using System;
using UnityEngine;
using UnityEngine.Playables;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Set Playable Director Wrap Mode")]
    [Category("Timeline/Playable Director/Wrap Mode")]
    [Description("Changes what the Playable Director does when it reaches the end of its Playable Asset")]

    [Image(typeof(IconDirector), ColorTheme.Type.Teal)]
    [Keywords("Timeline", "Cutscene", "Cinematic", "Sequence", "Loop", "Hold", "Extrapolation")]

    [Parameter("Playable Director", "The Playable Director component changed")]
    [Parameter("Wrap Mode", "Hold keeps the last frame, Loop starts over and None stops")]

    [Serializable]
    public class InstructionPlayableDirectorSetWrapMode : Instruction
    {
        [SerializeField] private GetGameObject m_PlayableDirector = new GetGameObject(
            new GenTypeGameObject_PlayableDirector()
        );

        [SerializeField] private DirectorWrapMode m_WrapMode = DirectorWrapMode.None;

        protected override string GetTitle(GameObject source)
        {
            string member = TextUtils.ThemeAsKeyword("Wrap Mode");
            return $"{this.m_PlayableDirector} {member} = {this.m_WrapMode}";
        }

        protected override Awaitable Run(Args args)
        {
            PlayableDirector director = this.m_PlayableDirector.Get<PlayableDirector>(args);
            if (director == null) return Done;

            director.extrapolationMode = this.m_WrapMode;
            return Done;
        }
    }
}
```

