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. Dismiss Notice

Project color library entries lost (4.6, 5.x, 5.4)

Discussion in 'Editor & General Support' started by Shushustorm, Mar 20, 2015.

  1. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    Hello everyone!
    Has anyone experienced the same problem?
    I ran into this already twice. Once while working with Unity 4.6, and right now while working with Unity 5.
    Unfortunately, I cannot get into this more specifically, because I cannot remember any overlapping circumstances of both cases.
    All I can say is that I created a color library for a project and at some point, while the .colors file was still located in the Editor folder, the entries were gone when I tried accessing them through the inspector.
    Could I have done something wrong for this to happen or does this seem to be a bug?

    Greetings,
    Shu
     
    Last edited: Mar 20, 2015
  2. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    Just wanted to leave a note here that this is still happening.
    I create color palettes, they are located in the Editor folder. I can click on the file and the Inspector shows all the colors.
    But after a while, mostly after changing a scene, the colors included in the palette will be gone. This only seems to happen ONCE per palette. If I remember correctly, there has never been a palette that got its colors deleted twice.
    Anyway, this is happening quite regularly now, which is not so cool.
    If I had to guess, it's about 80% of the libraries getting cleared of their content at some point.
     
  3. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    This still persists.
    Color library entries get deleted by themselves. It's always the whole library, not just singular entries.
    What's up with that?

    It has been almost 2 years now since I reported this happens in 4.6.
    Now, it still happens in 5.4.2f1 and I am pretty sure it's still present in 5.5 and 5.6 beta.

    Does nobody use color libraries?
    Or why am I seemingly the only person here that has trouble with this?
     
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,232
    Can you log a bug with a minimal reproduction project? ;)
     
    Shushustorm likes this.
  5. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    @richardkettlewell
    Thank you for your reply!
    How should I document this? I don't really know how this could have a reproduction project.
    It's very sporadic and project independent. Before the issue shows up, everything seems normal.
    And after the entries are gone.. well, they are gone then.
    Maybe I should send you one of the color libraries that this happened with?
    I highly doubt you can use that to reproduce the issue, but you may see some errors in the file's code?
    Let me know what you're thinking and I will report a bug accordingly.

    EDIT:
    I just took a look into the .colors code and it doesn't look suspicious.
    Maybe I should regularly backup the file's code.
     
    Last edited: Jan 15, 2017
  6. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,232
    Hmm it's a tricky one.. I guess we will struggle unless you can find any usage pattern that could be causing it..

    Hard to offer any great advice, other than to say, if you do realise what steps cause it, we will definitely look at it!

    It might be worth submitting a bug with the project after they are lost, but I guess it's likely that it's "too late" then, and qa won't be able to use the project in a useful way :(
     
    Shushustorm likes this.
  7. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    519
    @richardkettlewell I've had this happen occasionally too - the colour swatches being lost somewhere (using OSX Unity 4.x and 5.x). I never noticed exactly when it happened so could never reproduce it.
     
    Shushustorm likes this.
  8. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    @richardkettlewell
    I might have found the problem.
    I just inspected the .colors file that has had its colors deleted.
    Those files usually _do not_ get their colors deleted a second time (at least I cannot remember that that has happened at any point).

    The thing is, that file has its "m_Name" specified as the name that I have chosen when creating the .colors.
    On the other hand, when I create a new .colors, that file will just have blank space right next to "m_Name:" even though I gave it a name.

    I guess Unity rebuilds the .colors at some point because the name hasn't been saved (it is being displayed in the Editor's inspector, however, but that might just be cached?).
    Sounds like the rebuild process deletes the entries?

    This is the top part from a .colors that I just created (I named it "test"):

    __________

    %YAML 1.1
    %TAG !u! tag:unity3d.com,2011:
    --- !u!114 &1
    MonoBehaviour:
    m_ObjectHideFlags: 52
    m_PrefabParentObject: {fileID: 0}
    m_PrefabInternal: {fileID: 0}
    m_GameObject: {fileID: 0}
    m_Enabled: 1
    m_EditorHideFlags: 1
    m_Script: {fileID: 12323, guid: 0000000000000000e000000000000000, type: 0}
    m_Name:
    m_EditorClassIdentifier:
    m_Presets:

    __________

    This top part looks exactly the same in the file that has had its colors deleted with the exception that its name is shown there.

    In both cases, all the color entries are shown below "m_Presets".
    But, of course, I had to enter all the colors again in the first .color that has had its entries deleted.

    Also, I am running OSX 11.6 if that is useful information.

    EDIT:
    Some more information:
    I am creating the .colors inside the project.
    It is located in the "Editor" folder then.
     
    Last edited: Jan 17, 2017
  9. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,613
    I think the m_Name thing is probably a red herring - are you looking at the .colors file in between creating it and doing 'Save Project' ?
     
    Shushustorm likes this.
  10. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    @superpig
    @richardkettlewell

    Interesting. I didn't know one could even save a project. I always just closed the Editor.
    However, after creating a new .colors and clicking "Save Project", the following error gets spammed in the Console (always twice, each time I maximize the Console view (using touch gesture) and get back to the normal view; this behaviour stopped after trying to access the file from Visual Studio Code).

    This is the error:

    __________

    MissingReferenceException: The object of type 'ColorPresetLibrary' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    UnityEditor.Editor.IsOpenForEdit (System.String& message) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/Editor.cs:612)
    UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1101)

    UnityEditor.InspectorWindow.DrawEditors (UnityEditor.Editor[] editors) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1030)

    UnityEditor.InspectorWindow.OnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:352)

    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

    __________

    When trying to access the file after that error shows up, VSC tells me, the file cannot be displayed because it is a binary, very large or uses text encoding that isn't supported.

    Saving the project again and relaunching Unity as well as VSC doesn't change the fact that the .colors cannot be accessed with VSC anymore.
     
  11. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,232
    This error is very interesting - it sounds like you may have found a reproduction that you could submit as a bug report for us to recreate here?
     
  12. Shushustorm

    Shushustorm

    Joined:
    Jan 6, 2014
    Posts:
    1,084
    @richardkettlewell

    I was pretty sure I could reproduce this easily, so I made a list for reporting the bug.
    Unfortunately, I am not able to reproduce this.

    But here are the steps that, as far as I know, _should_ be causing this error (which they are not. Something is still missing to reproduce. I will update the list as soon as I run into a way to reproduce this reliably. Maybe somebody reading this knows what could be missing.):


    Using
    OSX 11.6
    Unity 5.4.2p2

    1. Open Unity
    2. Create new project
    3. Select "Main Camera"
    4. Click on "Main Camera"s Camera component's "Background" color
    5. Window is opening for color selection
    6. Click icon right next to "Presets"
    7. Click "Create New Library ..."
    8. Type a name: "test"
    9. Location: "Project Folder"
    10. Click "Create"
    11. test.colors should have been created in Assets/Editor/
    12. Add a few colors, name them
    13. File -> Save Project
     
    richardkettlewell likes this.
  13. nick-morhun

    nick-morhun

    Joined:
    May 12, 2015
    Posts:
    44
    Hi, I can still reproduce this with Unity 5.6.1f1.