- Home /
How to Assets > Reimport in C#?,
I have a prefab that, in Unity's inspector, doesn't appear to have references and variable values set. If I look at the .prefab file in a text editor, I can see that all the values and references are still present.
In order to get Unity to update the prefab with the information in the .prefab file, I Right-Click > Reimport the asset.
The issue is that I need to replicate the Assets > Reimport / Right-Click > Reimport functionality in a C# script. At the moment, I'm using AssetDatabase.ImportAsset(). I've tried different combinations of ImportAssetOptions.ForceSynchronousImport, ForceUpdate, and ImportRecursive, but nothing appears to update the prefab the way Reimport does.
I've consulted the Unity Cs Reference to see if there was a method I could use with reflection, but I wasn't able to find what I was looking for.
Is there a way to do a Reimport via C#? Thanks!