Search Unity

ImportAtPathImmediate is not supported for assets with import dependencies.

Discussion in 'Prefabs' started by SpookyCat, Jan 28, 2019.

  1. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,762
    I have just updated to 2018.3 from 2018.2 for one of my projects and now I am getting this error when I make prefab out of an object that contains procedural meshes. Everything worked fine in 2018.2 the mesh assets would created in the porject and the prefab that was then created would use them just fine. Now when i call AssetDatabase.CreateAsset for each mesh in the object I get the error:
    ImportAtPathImmediate is not supported for assets with import dependencies.

    The whole object is procedural, the meshes are generated at prefab creation time so where is this 'import dependency' coming from and how do I get around it. I have tried changing to AssetDatabase.AddObjectToAsset and that works in as far as the meshes are added to the prefab but the prefab objects no longer reference those meshes and all the meshfilters for the prefabs have empty meshes.
     
    Nevak and AlexandreDelan like this.
  2. Nevak

    Nevak

    Joined:
    Sep 27, 2012
    Posts:
    20
    I'm probably necroing this thread but I was scratching my head for a few hours with this.

    In my case I was calling
    Code (CSharp):
    1. ScriptableTest obj = ScriptableObject.CreateInstance<ScriptableTest>();
    2. AssetDatabase.CreateAsset(obj, assetPath + ".prefab");
    But obj was not a prefab or a GameObject. It was just an instance of a ScriptableObject so I changed the line to:
    Code (CSharp):
    1. AssetDatabase.CreateAsset(obj, assetPath + ".asset");
    And I can sleep tonight

    TL;DR: Watch the ".prefab" or ".asset" extension when calling AssetDatabase.CreateAsset

    There might be other reasons why you get this error, but just in case check that your path extensions make sense for CreateAsset
     
    eheimburg likes this.