Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

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

Discussion in 'Timeline' started by EZhex1991, Aug 8, 2018.

  1. EZhex1991

    EZhex1991

    Joined:
    Jun 25, 2017
    Posts:
    6
    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?
     
    Last edited: Aug 9, 2018
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    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.

    Code (CSharp):
    1. public class MyObjectPlayableAsset : PlayableAsset
    2. {
    3.      public ExposedReference<GameObject> sceneObject;
    4. ....
    5. }
    6.  
    7. public class MyAssetPlayableAsset : PlayableAsset
    8. {
    9.      public Material material;
    10. ....
    11. }
    12.  
    It looks like a bug was introduced for existing PlayableAssets on disk in the process.
     
  3. EZhex1991

    EZhex1991

    Joined:
    Jun 25, 2017
    Posts:
    6
    If someone is facing the same problem, please vote on this issue: https://issuetracker.unity3d.com/is...k-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.
     
    Last edited: Aug 20, 2018
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    We received the bug, and will look to get this fixed asap.
     
  5. EZhex1991

    EZhex1991

    Joined:
    Jun 25, 2017
    Posts:
    6
    This issue has been marked as "Fixed in Unity 2018.2", but I reproduced it in Unity 2018.2.4f1...
     
  6. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    That means a fix has been submitted, but it hasn't made it into an official release yet.
     
  7. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    The fix should be with 2018.2.7
     
    nathanjams likes this.
  8. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    305
    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.
     
    seant_unity likes this.
  9. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    305
    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:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.Selection.Contains (UnityEngine.Object obj) (at C:/buildslave/unity/build/Editor/Mono/Selection.cs:18)
    3. UnityEditor.Timeline.SelectionManager.Add (UnityEngine.Timeline.TrackAsset obj) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/TimelineSelection.cs:64)
    4. UnityEditor.Timeline.TimelineTreeView.SelectionChangedCallback (System.Int32[] ids) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/treeview/TimelineTreeView.cs:100)
    5. UnityEditor.IMGUI.Controls.TreeViewController.NotifyListenersThatSelectionChanged () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:439)
    6. 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)
    7. 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)
    8. 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)
    9. 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)
    10. 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)
    11. UnityEditor.IMGUI.Controls.TreeViewController.OnGUI (UnityEngine.Rect rect, System.Int32 keyboardControlID) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:601)
    12. UnityEditor.TimelineTreeViewGUI.OnGUI (UnityEngine.Rect rect) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/treeview/TimelineTreeViewGUI.cs:165)
    13. UnityEditor.Timeline.TimelineWindow.DrawTracksGUI (UnityEngine.Rect clientRect, UnityEditor.Timeline.TimelineModeGUIState trackState) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow_TrackGui.cs:157)
    14. 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)
    15. UnityEditor.Timeline.TimelineWindow.TrackViewsGUI () (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow_Gui.cs:124)
    16. UnityEditor.Timeline.TimelineWindow.SequencerGUI () (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow_Gui.cs:182)
    17. UnityEditor.Timeline.TimelineWindow.DoLayout () (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow_Gui.cs:79)
    18. UnityEditor.Timeline.TimelineWindow.OnGUI () (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow.cs:203)
    19. 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)
    20. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    21. 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)
    22. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <f2e6809acb14476a81f399aeb800f8f2>:0)
    23. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
    24. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
    25. UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:261)
    26. UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:392)
    27. UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:238)
    28. UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:376)
    29. UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:355)
    30. UnityEngine.Experimental.UIElements.EventDispatcher.PropagateEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:500)
    31. 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)
    32. UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:243)
    33. UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:74)
    34. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:171)
    35.  
    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
     
    Last edited: Oct 2, 2018
  10. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    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?
     
  11. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    The class name matches the filename. It's in the namespace PixelCrushers.DialogueSystem:

    SetQuestStateClip.cs
    Code (csharp):
    1. #if UNITY_2017_1_OR_NEWER && !(UNITY_2017_3 && UNITY_WSA)
    2. // Copyright © Pixel Crushers. All rights reserved.
    3.  
    4. using System;
    5. using UnityEngine;
    6. using UnityEngine.Playables;
    7. using UnityEngine.Timeline;
    8.  
    9. namespace PixelCrushers.DialogueSystem
    10. {
    11.  
    12.     [Serializable]
    13.     public class SetQuestStateClip : PlayableAsset, ITimelineClipAsset
    14.     {
    15.         public SetQuestStateBehaviour template = new SetQuestStateBehaviour();
    16.  
    17.         public ClipCaps clipCaps
    18.         {
    19.             get { return ClipCaps.None; }
    20.         }
    21.  
    22.         public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    23.         {
    24.             var playable = ScriptPlayable<SetQuestStateBehaviour>.Create(graph, template);
    25.             return playable;
    26.         }
    27.     }
    28. }
    29. #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:

    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.
     
  12. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    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.
     
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    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.
     
  14. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    305
    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
     
  15. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    305
    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:
    Code (CSharp):
    1.  #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
     
    Last edited: Oct 3, 2018
  16. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,731
    So this doesn't become a false lead, the exact compiler condition is:
    Code (csharp):
    1. #if UNITY_2017_1_OR_NEWER && !(UNITY_2017_3 && UNITY_WSA)