Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Parameter name: The Playable is null. when switched from 2018.4.0f1 to 2019.13

Discussion in 'Timeline' started by donov, May 25, 2019.

  1. donov

    donov

    Joined:
    Apr 15, 2013
    Posts:
    55
    Hi,
    I need some help with this one,
    I was going by the Unity Playables examples in the manual and created a ScriptPlayable that does some animation time scrubbing. Everything worked great in 2018 but when moved to 2019 I get a null error for the playable when using the extension methods

    Here is my scriptable playable code:


    Code (CSharp):
    1.  
    2.  
    3. public class PlayQueuePlayable : PlayableBehaviour
    4. {
    5.     private int m_CurrentClipIndex = -1;
    6.     private float m_TimeToNextClip;
    7.     private Playable mixer;
    8.  
    9.     public void Initialize(AnimationClip[] clipsToPlay, Playable owner, PlayableGraph graph)
    10.     {
    11.         owner.SetInputCount(1);
    12.         mixer = AnimationMixerPlayable.Create(graph, clipsToPlay.Length);
    13.         graph.Connect(mixer, 0, owner, 0);
    14.         owner.SetInputWeight(0, 1);
    15.  
    16.         for (int clipIndex = 0; clipIndex < mixer.GetInputCount(); ++clipIndex)
    17.         {
    18.             graph.Connect(AnimationClipPlayable.Create(graph, clipsToPlay[clipIndex]), 0, mixer, clipIndex);
    19.             mixer.SetInputWeight(clipIndex, 1.0f);
    20.         }
    21.     }
    22.  
    23.     public override void PrepareFrame(Playable owner, FrameData info)
    24.     {
    25.         if (mixer.GetInputCount() == 0)
    26.             return;
    27.  
    28.         // Adjust the weight of the inputs
    29.         for (int clipIndex = 0; clipIndex < mixer.GetInputCount(); ++clipIndex)
    30.         {
    31.             var clip = ((AnimationClipPlayable)mixer.GetInput(m_CurrentClipIndex));
    32.             Debug.Log(clip); //<-- Playable object exists
    33.             Debug.Log("clip: " + clip.GetAnimationClip()); //<-- Playable in extension is null
    34.             clip.SetTime(owner.GetTime());  //<-- Playable in extension is null
    35.             if (clipIndex == m_CurrentClipIndex)
    36.                 mixer.SetInputWeight(clipIndex, 1.0f);
    37.             else
    38.                 mixer.SetInputWeight(clipIndex, 0.0f);
    39.         }
    40.  
    41.     }
    42.  
    43. }
    Annotation 2019-05-25 065351.jpg
     
    Last edited: May 25, 2019
  2. donov

    donov

    Joined:
    Apr 15, 2013
    Posts:
    55
    Never mind :) I found I made a mess with the index variables