Why am I getting "AssetImporter is referencing an asset from the previous import..."?

Why am I getting this error?

ERROR [11:55:19] AssetImporter is referencing an asset from the previous import. This should not happen.

This occurs on a brand new 3D project in Unity 2018.3.10f1 when the only action I take after opening the project for the first time is to import the Oculus Unity Integration asset. (located here) via the asset store.

Why am I getting this error and what are the steps to resolve?

Thank you,
-Adam

Hi @Shinkaze33 ,

The error you are seeing is due to an asset having a broken reference to itself. The issue can be fixed by reserializing the problematic assets. In this case it’s:

\Assets\Oculus\SampleFramework\Core\CustomHands\Animations\r_hand_relax_3qtr_fist_anim.fbx

Unfortunately, reserializing can be done only through script, so I’ve attached a simple script that you can add in your Assets/Editor folder (you can create it if it doesn’t exist) and it will add an option to “Force Reserialize” when you right click the assets in the editor.

using UnityEditor;
using UnityEngine;

[CreateAssetMenu()]
public class PrefabReferenceFixer : ScriptableObject
{
    [MenuItem("Assets/Force Reserialize")]
    private static void ForceReserialize()
    {
        GameObject[] selection = Selection.gameObjects;
        string[] objectPaths = new string[selection.Length];

        for(int i = 0; i < selection.Length; ++i)
        {
            objectPaths _= AssetDatabase.GetAssetPath(selection*);*_

}

AssetDatabase.ForceReserializeAssets(objectPaths);
}
}
You can either reserialize the specific asset, or the whole Oculus folder. That should get rid of the error for you.
Thanks,
Martin

I was having the same issue. Reserializing didn’t help, but I found the solution.

The solution:
Posted by kubajs, here: https://forum.unity.com/threads/assetimporter-is-referencing-an-asset-from-the-previous-import-this-should-not-happen.568147/

I was able to fix the issue by moving the prefab to the hierarchy temporarily, setting the reference in the hierarchy and applying the prefab changes.

My knowledge of the correct terms to use is poor, so apologies in advance. The steps I used:

1.) Drag prefab into scene, to create as object

2.) In the new object, drag drop the prefab to the inspector’s reference (i.e. public GameObject …)

3.) At top of inspector, just below “layers” there’s a dropdown with text “overrides”; click that and select “apply all”. This will apply the changes to the prefab.

Note: the object in scene shows this reference as a prefab (blue box), but the prefab shows a regular object (grey box).