Is it possible to reimport multiple assets via script?
The process of using the Reimport command in the editor's Project window on multiple assets has become useful for our project, but it appears this may not have an equivalent public method for scripting.
Multiple reimports can be achieved through the following code:
string[] guids = AssetDatabase.FindAssets(query);
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
}
This isn't very practical when dealing with a hefty set of assets in a search query. By comparison, a reimport through an identical query from the Project window will take 28 seconds, but through this iteration script it will take 220 seconds!
Does anyone know of a more efficient alternative?
Your answer
![](https://koobas.hobune.stream/wayback/20220612222416im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Reimporting an asset from Editor Code 0 Answers
Reimport sprites - how to? 1 Answer
What does Object.DestroyImmediate(asset, true) do exactly? 4 Answers
ScriptableObjects inside another ScriptableObject not saving changes in Custom Editor Window 0 Answers
Why is my reimport from 5.6 to 2018.1 taking several hours and then freezing? 0 Answers