Search Unity

Mesh assets created in editor scripts keep getting re-imported

Discussion in 'Editor & General Support' started by Issam, Aug 9, 2016.

  1. Issam

    Issam

    Joined:
    Dec 18, 2012
    Posts:
    37
    I create a lot of mesh assets using the editor scripting (a lot .asset files that includes meshes), recently every time I leave play mode all those .asset file get updated (I get the "importing small assets" dialog, the editor log show it's "updating" those assets). Any idea why this might be happening? I was not happening before and now it takes at least 2 min every time I stop the play mode (Sometime it randomly do it while using the editor too).

    The weird thing is that it's even "updating" asset files not currently used in the scene, it also update the time stamp of the .asset files.

    Any idea what might be happening?
     
  2. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,051
    Are they in a Resources folder?
     
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    You probably have some custom editor scripting code in your project that gets triggered every time you leave play mode.
     
  4. Issam

    Issam

    Joined:
    Dec 18, 2012
    Posts:
    37
    They are not in a Resources folder. The problem seem to have been created by my code calling EditorSceneManager.SaveScene(SceneManager.GetActiveScene());

    It does not trigger a re-import when not in play mode, but for some reason because it get called from an OnEnable when coming from play mode it triggers the editor to think that some files need to be updated. Kind of weird that it try to reimport files unrelated to the scene, but for now I just disabled that code.