Search Unity

Textures destroyed after AssetDatabase.SaveAssets

Discussion in 'Asset Database' started by mdeletrain, Apr 12, 2013.

  1. mdeletrain

    mdeletrain

    Joined:
    Jun 8, 2011
    Posts:
    47
    Hi,

    I'm trying to create a texture manager that uses Unity's texture packing, and update managed textures automatically when new textures are found on some predefined folders.

    I've attached the interesting part of my class file : View attachment $TextureManager.cs .

    The problem is, sometimes, but not always, some of the loaded textures, but not always the sames, get destroyed after calling AssetDatabase.SaveAssets().

    In the provided source code I made evidence of this by trying to log all loaded texture names : this is working fine before the call to the AssetDatabase.SaveAssets() function, and it sometimes crashes when trying to log after the call, with a message saying that the object should not be accessed anymore since it has been destroyed...

    This is reproducible with Unity 3.5.7 and Unity 4.1.1.

    Does anybody have any though about why this is happening ?
     
  2. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Just noticed this happening myself. Happens in NGUI when you create a brand new atlas the first time after starting Unity. Repeating the process right after getting the null exception works fine and doesn't seem to happen ever again.

    Bug?