Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Asset dependencies or Asset Import Order?

Discussion in 'Scripting' started by Seanba, Feb 21, 2018.

  1. Seanba

    Seanba

    Joined:
    Nov 17, 2012
    Posts:
    33
    I'm working on something where one asset type (using a custom importer script) is dependent on another asset (in this case, a texture).

    When both assets are being imported at the same time I'd like to ensure that the texture is imported first so that any calls to AssetDatabase.LoadAssetAtPath from the custom importer will succeed.

    Is there a way to achieve this through scripting?
     
  2. Seanba

    Seanba

    Joined:
    Nov 17, 2012
    Posts:
    33
    FWIW, I eventually solved this by using the experimental Scripted Importers and in particular making use of the importQueueOffset parameter of the ScriptedImporterAttribute. Not exactly what I was looking for but being able the control the order in which asset types are imported did the trick for me nicely.