- Home /
How to guard against CreateAsset() failing?
I'm creating assets (meshes) with AssetDatabase.CreateAsset(mesh, path)
inside a loop. Very rarely, it fails, even though I'm checking before each call that both the mesh and the path are valid.
As CreateAsset() returns void, what is the accepted way to check for a result?
I'm also displaying a progress bar during the loop. If CreateAsset() fails, Unity is aborting from the method, and so the finishing call to EditorUtility.ClearProgressBar(); never gets called. This for all intents & purposes freezes Unity as the progress bar is trapped in front.
Is there a way to catch the CreateAsset() fail that would allow me to clear the progress bar?
Thanks for any suggestions!
Your answer
Follow this Question
Related Questions
How to allow Undo on project assets created with an editor script? 0 Answers
"Save As..." Saving level assets at Runtime 0 Answers
When looping through assetbundle assetdatabase how do you reference a material object 0 Answers
Can I safely put a prefab asset into version control with Unity Free? 3 Answers