Search Unity

Track cannot be loaded until I force a recompile

Discussion in 'Timeline' started by atlas_r, Mar 11, 2022.

  1. atlas_r

    atlas_r

    Joined:
    Feb 15, 2016
    Posts:
    6
    In Unity 2021.2.10 Every time I open Unity my custom track says it can't be loaded. There are no errors or relevant warnings in the console. If I force a recompile of all scripts by making a dummy change in a script, such as adding a space character somewhere and switching back to Unity, then it suddenly works and my custom tracks appear... until the next time that I open Unity and need to make another dummy change in a script.

    Ideas on how to fix it more permanently?
     

    Attached Files:

  2. sebj

    sebj

    Joined:
    Dec 4, 2013
    Posts:
    70
    I am encountering the same bug in 2021.3.3f1.
     
  3. BrianJiang

    BrianJiang

    Joined:
    Jun 11, 2017
    Posts:
    7
    Same here 2022.1.9f1
     
  4. Prince_of_Persia

    Prince_of_Persia

    Joined:
    Oct 20, 2012
    Posts:
    56
    I am having the exact same issue, 2019.4.31f1
     
  5. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
  6. Prince_of_Persia

    Prince_of_Persia

    Joined:
    Oct 20, 2012
    Posts:
    56
    My Problem was that I was having two classes (TrackAsset and PlayableAsset) in one .cs file. I seperated them into two files and files having the same name as the class name. Problem gone.
     
  7. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    That is correct. Classes that derive from ScriptableObject and Monobehaviour need to be in separate .cs files. This is a limitation of Unity's serialization system. Since TrackAsset and PlayableAsset are also ScriptableObjects, they need to be located in separate files too.
     
  8. hansson_ftw

    hansson_ftw

    Joined:
    Nov 25, 2019
    Posts:
    1
    I'm having the same issue in 2022.2.17f1. Even though the classes are in separate files.
    If I make a dummy change in a script like atlas_r mentioned, then it works, until I restart unity.

    [Fixed]
    The issue occured with timeline tracks that were created when the classes were in the same file. However when I separated the classes into separate files, the problem still ocurred with the existing timeline tracks, but new timeline tracks were fine.
    So I guess the old ones were saved in a broken state or something.
     
    Last edited: May 19, 2023
    zero557 likes this.