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.
https://assetstore.unity.com/packages/tools/integration/oculus-integration-82022
Why am I getting this error and what are the steps to resolve?
Thank you, -Adam
This occurs on Step 3 of the following instructions.
https://developer.oculus.com/documentation/unity/latest/concepts/unity-import/
Answer by Martinch01 · Jun 04, 2019 at 03:19 PM
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[i] = AssetDatabase.GetAssetPath(selection[i]);
}
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
Thank you for your answer, this fixed the problem for me!
This script doesn't seem to be doing anything for me. I'm having the exact same issue with the exact same Unity version. I created an Assets/Editor folder, created a PrefabReferenceFixer script, pasted your code, right clicked the Oculus folder, clicked "Force Reserialize". Nothing happened and the error is still there...
Did I do something wrong? Is there an Option I should enable?
@stuck_cow Did you do anything else different?
I had an error with one of my prefabs:
Asset import did not unload metadata path. This will leak memory. File a bug with repro steps please. [Prefab Name] UnityEditor.PrefabImporterEditor:OnDestroy()
and your script solved the problem. Thank you, $$anonymous$$artin.
Answer by learn2burn13 · May 17, 2021 at 07:36 AM
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:
Drag prefab into scene, to create as object
In the new object, drag drop the prefab to the inspector's reference (i.e. public GameObject ...)
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).
Your answer
Follow this Question
Related Questions
,Cannot Enter Play Mode when I download assets from assets store 1 Answer
Accessing Unity Assets (SFX) as .WAV FILES? Having Trouble Downloading + Importing Assets 0 Answers
Unity HDRP Crashing/Freezing during asset store import 1 Answer
I'm using unity 2017.2.of3 and when i download and import fungus, i get an error message. 0 Answers