您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
691 B
36 行
691 B
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
|
|
[RequireComponent(typeof(PlayableDirector))]
|
|
public class TimelineLoop : MonoBehaviour
|
|
{
|
|
PlayableDirector m_Director;
|
|
|
|
[SerializeField]
|
|
float m_Start;
|
|
[SerializeField]
|
|
float m_Duration;
|
|
|
|
void OnEnable()
|
|
{
|
|
m_Director = GetComponent<PlayableDirector>();
|
|
StartCoroutine(Loop());
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
StopAllCoroutines();
|
|
}
|
|
|
|
IEnumerator Loop()
|
|
{
|
|
for (;;)
|
|
{
|
|
m_Director.time = m_Start;
|
|
yield return new WaitForSeconds(m_Duration);
|
|
}
|
|
}
|
|
}
|