Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

TimelineController Tutorial Script Broken

Discussion in 'Timeline' started by Acreates, Jul 16, 2018.

  1. Acreates

    Acreates

    Joined:
    Dec 12, 2016
    Posts:
    25
    Maybe since the update

    https://unity3d.com/learn/tutorials/topics/animation/using-timeline-custom-scripts

    But this tutorial's script labeled "TimelineController" has several errors.

    System.collections.GenericList<T> requires '1' type arguement (s)
    and
    Enumerator issue where "foreach" is present.

    Below is the script copied from the tutorial:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.Playables;
    using UnityEngine.Timeline;

    public class TimelineController : MonoBehaviour {

    public List playableDirectors;
    public List timelines;


    public void Play()
    {
    foreach (PlayableDirector playableDirector in playableDirectors)
    {
    playableDirector.Play ();
    }
    }

    public void PlayFromTimelines(int index)
    {
    TimelineAsset selectedAsset;

    if (timelines.Count <= index)
    {
    selectedAsset = timelines [timelines.Count - 1];
    }
    else
    {
    selectedAsset = timelines [index];
    }

    playableDirectors [0].Play (selectedAsset);
    }
    }
     
  2. Acreates

    Acreates

    Joined:
    Dec 12, 2016
    Posts:
    25
    Should be this instead:
    public List<PlayableDirector> playableDirectors;
    public List<TimelineAsset> timelines;
     
  3. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    146
    We'll fix this. Thanks!
     
unityunity