Search Unity

Cannot apply labels with script (possible bug with Asset Cache Server)

Discussion in 'Editor & General Support' started by Molix, Mar 19, 2012.

  1. Molix

    Molix

    Joined:
    Apr 24, 2009
    Posts:
    92
    I made a simple little editor script to add/remove/clear labels on a set of objects. It seems to work fine (AssetDatabase.SetLabels()), except that when you begin to Play, Unity warns that the modified assets have not been re-imported since being modified.

    The problem: when the asset is re-imported, either manually (by right-clicking) or through script (with AssetDatabase.ImportAsset()), the label changes are lost.

    However, if I turn off "Use Cache Server", it is fine. Presumably, the optimization of getting imported assets from the cache server is ignoring the actual changes made locally to the asset's labels and just copying the asset from the server. That seems like a bug.

    We definitely can't stop using the cache server, so any thoughts on workarounds?
     
  2. kurzemnieks

    kurzemnieks

    Joined:
    Nov 22, 2012
    Posts:
    16
    I run into similar problem, where SetLabels was not working. What helped was calling:
    AssetDatabase.ImportAsset(assetImporter.assetPath);
    after SetLabels.
     
    BackgroundMover likes this.