Hi everyone,
I’m running into an interesting problem. Right now I have some asset postprocessor code that runs in OnAssignMaterialModel. The first thing it does is load a ScriptableObject so that I can access some global asset data I need. I am currently using Resources.Load (as the SO lives in the Resources folder) to load the asset.
This all works well in the editor when I change one of my model files and it reimports, or if I right-click and reimport a model asset directly. However, if I tell Unity to “reimport all”, it fails. Specifically, Resources.Load returns null in this case. I’ve tried changing this to AssetDatabase.LoadAssetAtPath and this also works in-editor, but also returns null on “reimport all”.
I suspect it’s not working because to reimport all, Unity restarts itself and the editor isn’t actually running during reimport. I’m not sure why it wouldn’t let me load an asset though, unless not even the AssetDatabase exists yet?
Has anyone ever run into this? Anyone have any ideas on how to load my asset? Work arounds? I spent the day trying different things with nothing working and having to reimport our entire game each time, so any tips are appreciated. ![]()
Thanks!
Owen