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

ControlTrack throw exception

Discussion in 'Timeline' started by fuy, Dec 3, 2021.

  1. fuy

    fuy

    Joined:
    Sep 24, 2014
    Posts:
    30
    a exception throw when select a timeline prefab that contain a control track which parent object is not null

    stacktrace:
    ArgumentException: Transform parent is not allowed be part of a Prefab Asset
    UnityEditor.PrefabUtility.InstantiatePrefab_internal (UnityEngine.Object target, UnityEngine.SceneManagement.Scene destinationScene, UnityEngine.Transform parent) (at <bbfbd5a71eea45d1a1354233c800516b>:0)
    UnityEditor.PrefabUtility.InstantiatePrefab (UnityEngine.Object assetComponentOrGameObject, UnityEngine.Transform parent) (at <bbfbd5a71eea45d1a1354233c800516b>:0)
    UnityEngine.Timeline.PrefabControlPlayable.Initialize (UnityEngine.GameObject prefabGameObject, UnityEngine.Transform parentTransform) (at Packages/com.unity.timeline@1.5.5/Runtime/Playables/PrefabControlPlayable.cs:63)
    UnityEngine.Timeline.PrefabControlPlayable.Create (UnityEngine.Playables.PlayableGraph graph, UnityEngine.GameObject prefabGameObject, UnityEngine.Transform parentTransform) (at Packages/com.unity.timeline@1.5.5/Runtime/Playables/PrefabControlPlayable.cs:31)
    UnityEngine.Timeline.ControlPlayableAsset.CreatePlayable (UnityEngine.Playables.PlayableGraph graph, UnityEngine.GameObject go) (at Packages/com.unity.timeline@1.5.5/Runtime/Control/ControlPlayableAsset.cs:134)
    UnityEngine.Timeline.TrackAsset.CreatePlayable (UnityEngine.Playables.PlayableGraph graph, UnityEngine.GameObject gameObject, UnityEngine.Timeline.TimelineClip clip) (at Packages/com.unity.timeline@1.5.5/Runtime/TrackAsset.cs:1164)
    UnityEngine.Timeline.TrackAsset.CompileClips (UnityEngine.Playables.PlayableGraph graph, UnityEngine.GameObject go, System.Collections.Generic.IList`1[T] timelineClips, UnityEngine.Timeline.IntervalTree`1[T] tree) (at Packages/com.unity.timeline@1.5.5/Runtime/TrackAsset.cs:795)
    UnityEngine.Timeline.TrackAsset.CreateMixerPlayableGraph (UnityEngine.Playables.PlayableGraph graph, UnityEngine.GameObject go, UnityEngine.Timeline.IntervalTree`1[T] tree) (at Packages/com.unity.timeline@1.5.5/Runtime/TrackAsset.cs:869)
    UnityEngine.Timeline.TrackAsset.CreatePlayableGraph (UnityEngine.Playables.PlayableGraph graph, UnityEngine.GameObject go, UnityEngine.Timeline.IntervalTree`1[T] tree, UnityEngine.Playables.Playable timelinePlayable) (at Packages/com.unity.timeline@1.5.5/Runtime/TrackAsset.cs:772)
    UnityEngine.Timeline.TimelinePlayable.CreateTrackPlayable (UnityEngine.Playables.PlayableGraph graph, UnityEngine.Playables.Playable timelinePlayable, UnityEngine.Timeline.TrackAsset track, UnityEngine.GameObject go, System.Boolean createOutputs) (at Packages/com.unity.timeline@1.5.5/Runtime/TimelinePlayable.cs:201)
    ...

    ps:
    this exception cause timeline preview stop working!!!
     
  2. fuy

    fuy

    Joined:
    Sep 24, 2014
    Posts:
    30
    i tested timeline: 1.5.5, 1.5.7, 1.7.0
    unity: 2020.3.24
     
  3. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    What do you mean by "parent object is not null"?

    Could you file a bug with your scene and Timeline, using the bug reporter?
    This seems to be a rather specific case with pretty specific reproduction steps, otherwise we would have had reports of it before.
     
  4. fuy

    fuy

    Joined:
    Sep 24, 2014
    Posts:
    30
    i reported, case: 1386125
    just select the TestTimeline.prefab, you will see the exception
     
  5. fuy

    fuy

    Joined:
    Sep 24, 2014
    Posts:
    30
    parent object is not null
    means:
    upload_2021-12-6_9-32-32.png
     
  6. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Thank you for your bug report.

    The Parent Object field is intended for Scene Objects, not prefabs, and should filter the objects accordingly.

    We will update the filtering, but in the meantime, I would suggest that you either leave the field empty or provide a Scene object to parent your prefab to.
     
  7. fuy

    fuy

    Joined:
    Sep 24, 2014
    Posts:
    30
    upload_2021-12-7_9-3-29.png
    "ts" is child of Director; so we can change the position of the same particlesystem in different timelines, is it wrong?
     
  8. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    No, this is the correct workflow when working in prefabs.

    I was jumping around between asset view (when you select the asset in the project), in-scene view (when you select a PlayableDirector instance) and prefab view (when you select a prefab with a PlayableDirector on it in the project), and I got mixed up.

    We'll need to make sure objects are not parented to non-instantiated prefabs.

    In the meantime, the only workaround seems to be to close the Timeline Window before selecting the prefab and going to prefab isolation.
     
  9. fuy

    fuy

    Joined:
    Sep 24, 2014
    Posts:
    30
    my workaround is to modify ControlPlayableAsset.cs:
    everything seems ok
    upload_2021-12-8_10-20-49.png
     
  10. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Indeed, that was our first attempt to fix it.
    You can also use EditorUtility.IsPersistent to achieve the same thing, since the issue is that the transform is part of a prefab that was not instantiated.

    This won't be our final fix, but that will work around the issue for now.

    If you're interested, the actual fix we're implementing is to entirely prevent a PlayableGraph from being created when we are Editing a Timeline in the context of a Prefab, but not in prefab isolation mode.
     
  11. fuy

    fuy

    Joined:
    Sep 24, 2014
    Posts:
    30
    cool, your final fix is better.
    expect your patch, thanks for your patience
     
  12. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    No, thank you very much for the thread and the bug report, it is much appreciated.