I have a huge FBX file which contains make animations.
I want to split these into different takes by using a C# script file.
It worked, but it happened often that I messed up the FBX file because my script was just not perfect yet.
What I did in such a case was to restore a backup manually.
However, after having to do that over 30 times already, I thought that I could simply copy the original FBX and its meta data and work with the copy.
This way I would not have to backup / restore the original fbx each time.
I would create the copy at the start of my script.
And then I would call my usual code like this:
ModelImporter nModelImporter = (ModelImporter)AssetImporter.GetAtPath(sCopyOfFBXFile);
if (nModelImporter == null)
To my surprise, the ModelImporter of the newly created copy is “Null”.
The next thing that came to my mind was that perhaps Unity misses the “.fbx.meta” file, so I copied the .meta file, too.
The problem would still persist: The ModelImporter was still Null.
The next thing I tried to call
Still didn’t help.
The solution was to stop the script after the creation of the Unity.
In other words: Unity needed some time on its own without the script still running.
Then Unity would work hard and show a progress bar which indicates that it’s now processing the newly created .fbx file.
Then I could run another script which would then do the ModelImporter work on the new copy.
However, I don’t want to wait that long until Unity has processed the copy, and I don’t want to use 2 steps for a process of which I feel could be done in a single script.
I wanted to provide Unity a perfect copy of which it would automatically know that it doesn’t have to do any more work on. I thought that providing the .meta file would do this job.
Does anybody know why that is not the case and what I would have to do in order to work without interrupting my script intentionally?