Custom PlayableAsset Files Cannot Drag into Custom Track in Unity-2018.2

I have an ExpressionTrack inherits TrackAsset, which has an attribute [TrackClipType(typeof(ExpressionPlayableAsset))].
Since ExpressionPlayableAsset inherits PlayableAsset inherits ScriptableObject, I can create ExpressionPlayableAsset assets in my project, and reuse them by drag it into my ExpressionTrack, there will be a clip linked to my asset file.

It works fine in Unity-2017.4 & Unity-2018.1, but no longer since 2018.2.0. I can’t drag any custom playable asset to tracks in newer version.

So if I use attribute TrackClipType(typeof(CustomPlayableAsset), allowAutoCreate: false) on a custom track, I won’t be able to create clip on the track, neither from an asset file.To me, this track is simply unusable…

And in the Timeline window, if I right click on a clip which reference to a asset file, the last menu shows “Find Source Asset”, it also works fine until 2018.1.3 (maybe later). When I updated my Unity to 2018.1.9, I could only do this on built-in clip types, if I do this on custom clip, this menu item turned grey, just like those non-reference clips.
(But still, I can change my Inspector window into Debug mode, and find a property named “Asset”, it will contains the Object reference)

Did I use it wrong, or is it a bug? I have so many custom PlayableAsset files in my project and I cannot use it in 2018.2 anymore. Is there any way to fix it, or should I revert my Unity to 2018.1?

This is a definitely a bug. I’d strongly recommend submitting a bug through the bug reporter for tracking purposes.

The drag and drop was rebuild for 2018.2, to support the more common workflows of having timeline own and manage the custom playable assets.

For example, the following custom playable assets will now automatically support drag and drop of gameObjects and Materials respectively and create the appropriate assets on the corresponding tracks.

public class MyObjectPlayableAsset : PlayableAsset
{
     public ExposedReference<GameObject> sceneObject;
....
}

public class MyAssetPlayableAsset : PlayableAsset
{
     public Material material;
....
}

It looks like a bug was introduced for existing PlayableAssets on disk in the process.

If someone is facing the same problem, please vote on this issue: Unity Issue Tracker - Cannot attach custom Playable Asset to the track in Timeline when using drag and drop option

I tried to open my project with 2018.1, but seems prefab in 2018.2 has different serialization from 2018.1, all the prefab references turned to red Missing… So open 2018.2 project with old Unity version is not a good choice, maybe I should just wait for the next release.

We received the bug, and will look to get this fixed asap.

This issue has been marked as “Fixed in Unity 2018.2”, but I reproduced it in Unity 2018.2.4f1…

That means a fix has been submitted, but it hasn’t made it into an official release yet.

The fix should be with 2018.2.7

1 Like

I can confirm that I was having this issue and 2018.2.7 resolved the issue.

Thank you. This was driving me crazy for weeks.

1 Like

Hey, @seant_unity

Just Updated to Unity 2018.2.10f and these errors have reappeared. This literally breaks our game.

I tried opening on 2018.2.8f and the errors are still there though they were not when we went 2018.2.7f to 2018.2.8f

I’m pretty sure this exactly the same problem as mentioned in the original post as it is only the plugins that have drag and drop functionality that are broken in our project. The error that appears are:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Selection.Contains (UnityEngine.Object obj) (at C:/buildslave/unity/build/Editor/Mono/Selection.cs:18)
UnityEditor.Timeline.SelectionManager.Add (UnityEngine.Timeline.TrackAsset obj) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/TimelineSelection.cs:64)
UnityEditor.Timeline.TimelineTreeView.SelectionChangedCallback (System.Int32[] ids) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/treeview/TimelineTreeView.cs:100)
UnityEditor.IMGUI.Controls.TreeViewController.NotifyListenersThatSelectionChanged () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:439)
UnityEditor.IMGUI.Controls.TreeViewController.NewSelectionFromUserInteraction (System.Collections.Generic.List`1[T] newSelection, System.Int32 itemID) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:1163)
UnityEditor.IMGUI.Controls.TreeViewController.SelectionClick (UnityEditor.IMGUI.Controls.TreeViewItem itemClicked, System.Boolean keepMultiSelection) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:1152)
UnityEditor.IMGUI.Controls.TreeViewController.HandleUnusedMouseEventsForItem (UnityEngine.Rect rect, UnityEditor.IMGUI.Controls.TreeViewItem item, System.Int32 row) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:345)
UnityEditor.IMGUI.Controls.TreeViewController.DoItemGUI (UnityEditor.IMGUI.Controls.TreeViewItem item, System.Int32 row, System.Single rowWidth, System.Boolean hasFocus) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:504)
UnityEditor.IMGUI.Controls.TreeViewController.IterateVisibleItems (System.Int32 firstRow, System.Int32 numVisibleRows, System.Single rowWidth, System.Boolean hasFocus) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:670)
UnityEditor.IMGUI.Controls.TreeViewController.OnGUI (UnityEngine.Rect rect, System.Int32 keyboardControlID) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:601)
UnityEditor.TimelineTreeViewGUI.OnGUI (UnityEngine.Rect rect) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/treeview/TimelineTreeViewGUI.cs:165)
UnityEditor.Timeline.TimelineWindow.DrawTracksGUI (UnityEngine.Rect clientRect, UnityEditor.Timeline.TimelineModeGUIState trackState) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow_TrackGui.cs:157)
UnityEditor.Timeline.TimelineWindow.TracksGUI (UnityEngine.Rect clientRect, UnityEditor.Timeline.WindowState state, UnityEditor.Timeline.TimelineModeGUIState trackState) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow_TrackGui.cs:58)
UnityEditor.Timeline.TimelineWindow.TrackViewsGUI () (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow_Gui.cs:124)
UnityEditor.Timeline.TimelineWindow.SequencerGUI () (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow_Gui.cs:182)
UnityEditor.Timeline.TimelineWindow.DoLayout () (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow_Gui.cs:79)
UnityEditor.Timeline.TimelineWindow.OnGUI () (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow.cs:203)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:261)
UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:392)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:238)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:376)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:355)
UnityEngine.Experimental.UIElements.EventDispatcher.PropagateEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:500)
UnityEngine.Experimental.UIElements.EventDispatcher.DispatchEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:345)
UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:243)
UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:74)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:171)

And I get this message when I click on the broken plugin component in the timeline:
“No Script asset for SetQuestStateClip. Check that the definition is in a file of the same name” "

Any help would be most appreciated

That error appears when the PlayableAsset derived class doesn’t have a filename that matches. This is a limitation of scriptable objects in Unity. Any chance your SetQuestStateClip is not in a file called SetQuestStateClip.cs?

The class name matches the filename. It’s in the namespace PixelCrushers.DialogueSystem:

SetQuestStateClip.cs

#if UNITY_2017_1_OR_NEWER && !(UNITY_2017_3 && UNITY_WSA)
// Copyright © Pixel Crushers. All rights reserved.

using System;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;

namespace PixelCrushers.DialogueSystem
{

    [Serializable]
    public class SetQuestStateClip : PlayableAsset, ITimelineClipAsset
    {
        public SetQuestStateBehaviour template = new SetQuestStateBehaviour();

        public ClipCaps clipCaps
        {
            get { return ClipCaps.None; }
        }

        public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
        {
            var playable = ScriptPlayable<SetQuestStateBehaviour>.Create(graph, template);
            return playable;
        }
    }
}
#endif

The other class names match filenames, too: QuestStateMixerBehaviour, QuestStateTrack, SetQuestStateBehaviour.

However, there is one thing that I’ve submitted a bug report on. In Unity 2017+, the inspector for several scripts, including this one, show:

3742153--310810--invalidutf8.png

However, the file is otherwise fine, it compiles, and Unity 5.x’s inspector shows it just fine. The problem is the copyright “(c)” character. I’ll be removing that character from scripts in the next release of this asset.

Have you tried removing that copyright? I ask because I think the problems are related to the script compilation. I’ve been trying to repro the issue locally without success.

If you have a repro case I could try that would help. Feel free to post it, or DM it to me.

I’ve asked @nathanjams to test this. I haven’t been able to reproduce it, but there may be differences in the way he’s set up his timelines versus my tests.

Hi @TonyLi and @seant_unity

Hey guys, thanks for the replies. Changing the copyright didn’t fix the issue unfortunately for the broken build.
I had made a duplicate of a working version of our project last night (working on Unity 2018.2.8) and changed the copyright in the code before opening the project in Unity 2018.2.10 and there were no errors.

I will make another copy tonight of that same version to see if not making those changes to the copyright have any effect.

There is a wildcard here is we have started using a SVN system here in the last two weeks so perhaps something in that process is breaking something.

Unfortunately I can’t share the project because it is almost 100 gigs

I will post tomorrow with an update.
Thanks for your time with this.

Nathan

Hey again, @TonyLi and @seant_unity
So I found the culprit but it makes no sense to me. Maybe one of you can explain.

Tony’s suggestion to remove the copyright icon got me looking at the headers of the scripts so I tried removing the encapsulating condition: #if Unity2017_1_OR_Newer && !(UNITY_2017_3 && UNITY_WSA) and my issues were fixed.

This doesn’t make any sense because we are running Unity 2018.2.10 and this issue has been popping up throughout the 2018.2.x release.

During the 2018.2.4 and 2018.2.5 releases (i believe) rebuilding the library would break our Dialogue System plugins. Then with the 2018.2.7 release we could rebuild the library without issue.

I’m not sure why the use of SVN would break this again but somehow the project files or settings are not liking that condition.

Anyways, I’ll post more if I figure anything else. Thanks again for your time.

Nathan

So this doesn’t become a false lead, the exact compiler condition is:

#if UNITY_2017_1_OR_NEWER && !(UNITY_2017_3 && UNITY_WSA)