Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Timeline Signals are not received by Signal Receiver when TimelineAsset was loaded from an AssetBund

Discussion in 'Timeline' started by ewoutee, Jan 24, 2020.

  1. ewoutee

    ewoutee

    Joined:
    Mar 11, 2016
    Posts:
    2
    I can't seem to figure out how to get my timeline signals to work.

    When I load a TimelineAsset at runtime from an AssetBundle (LoadTimelineFromAssetBundle()) and play it on a PlayableDirector, the attached SignalReceiver does not receive any signals, despite several being present on the timeline.

    When loading the same TimelineAsset from the Resources folder (LoadTimelineFromResources()), the signals are received by the SignalReceiver.

    This is my code:
    Code (CSharp):
    1.  
    2. public class LoaderController : MonoBehaviour
    3. {
    4.     public string AssetBundleName = "myassetbundle";
    5.     public string TimelineAssetName = "MyTimeline";
    6.  
    7.     public void LoadTimelineFromAssetBundle()
    8.     {
    9.         AssetBundle loadedAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, AssetBundleName));
    10.         TimelineAsset timeline = loadedAssetBundle.LoadAsset<TimelineAsset>(TimelineAssetName);
    11.         PlayTimeline(timeline);
    12.     }
    13.  
    14.     public void LoadTimelineFromResources()
    15.     {
    16.         TimelineAsset timeline = Resources.Load<TimelineAsset>(TimelineAssetName);
    17.         PlayTimeline(timeline);
    18.     }
    19.  
    20.     private void PlayTimeline(TimelineAsset timeline)
    21.     {
    22.         GetComponent<PlayableDirector>().Play(timeline);
    23.     }
    24. }
    And screenshots of my timeline and signal emitter:
    signal emitter.png
    timeline.png

    I have encountered this issue on versions 2019.2.17f1, 2019.2.19f1 and 2019.3.0f3.
    Is this a bug or am I missing something obvious here?
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Since the signals are themselves assets that are referenced by both the signal receiver in the scene, and the timeline asset, I suspect that by loading the scene and timeline separately, one of those links is broken.

    In this case, the playable director (in a prefab) and the timeline should be part of the same bundle, or some sort of post fix-up is required to re-establish the link.
     
    ewoutee likes this.
  3. ewoutee

    ewoutee

    Joined:
    Mar 11, 2016
    Posts:
    2
    I tried this, and it solved the problem! Thank you very much, I'm not sure if this is intended behaviour or just a bug still?
     
    Last edited: Jan 24, 2020