I’ve had something that I’ve been curious about for a while now, but I wasn’t sure how to go about it if anyone is familiar with ScriptedImporters or the import pipeline in general. It’s related to ScriptedImporterAttribute.importQueuePriority.
I’ve wanted to understand what the native unity assets’ import order is. For example, if textures are imported after prefabs, etc, and trying to understand the best place to set a custom ScriptedImporter’s queue priority. I’ve personally found that setting the priority to 10 works relatively well, but I’d like to fully understand the system better.
My reasoning to understand is because I make the importer use AssetImportContext.DependsOnSourceAsset to reimport an asset if any certain assets are modified, and they could be many different types, like textures or prefabs. I’ve had to configure the import order many different times to find an ideal order where there are no issues when doing my custom asset import.
The documentation recommends a number from -3000 and above, but they aren’t specific about the order of individual native asset types or their own numerical order. The documentation even says that “each native type has its own queue order”.
But maybe there is a way to view the orderings of each particular asset type to understand the order of imported assets? I would have hoped that there would be a grand list of all native assets paired with their import order so that I can make the best decision about where to set a custom importer order.
Another option for me is to test with individual asset types and record what is imported before/after. But I’m just curious if there is some information out there that might explain the specifics faster than testing myself. Searching for answers came up with very few forum posts or even google results related to this topic. I would be interested if anyone has some insight. Otherwise, I could test on my own sometime if anyone else is interested in the subject 
I performed some testing with the AssetPostProcesser.OnPreProcessAsset function, and narrowing down the import order of several scripted importers and a prefab by importing them while multi-selecting. After some testing, I was able to figure out that a prefab’s import priority is either 500/501. I was mostly wondering about the prefab’s import order so I can work around it. I won’t be interested to figure out the import order of any other asset types, but if I eventually do, then I’ll edit in more of my findings here. 
Texture2D: -2004/-2003
ScriptableObject: -801/-800
Prefab: 500/501
2 Likes
would be very nice to get some insight on Cameo221’s question…
Default queue priorities are (lower/smaller numbers are earlier):
-
Scripts, Assembly Definitions, etc.
-
Don’t set earlier than -9999
-
Textures = -1003
-
Shader Includes = -1002
-
Shaders= -1001
-
SketchUp = 0
-
Fonts = 2
-
Models = 99
-
Animation Clips= 100
-
SpeedTrees = 100
-
Animator Controllers = 150
-
ScriptableObjects (and other .asset types) = 200
-
The Default for Scripted Importers = 1000 (offset values using importQueueOffset are relative to this value)
-
Audio Clips = 1100
-
Note: in 2021.3 LTS Audio used 1000, but this is fixed in 2022.3 LTS and later
-
Prefabs = 1500
-
Unity Style Sheets (.uss): 2100
-
Unity Theme Style Sheets (.tss): 2101
-
Unity XML (.uxml): 2102
-
You probably don’t want to set higher than 2998
-
Search Database Indices (.index): 2999
So, @Cameo221 , you can see you were correct with your values, since setting an offset of 500 relative to the default of 1000 puts prefabs at 1500.
Note: ScriptedImporterAttribute.importQueuePriority is a 1-to-1 value match with the importQueueOffset in the ScriptedImporter attribute constructor - meaning they match eachother and are both relative to the default of 1000.
2 Likes
Wonderful! That’s really cool. Great to see these orders out in the open. Potentially this could be a specification somewhere in the unity docs. But this post is also great. This should help a lot for anyone who works with importers! 
2 Likes
Good call on updating the docs, I’ve made a request for that to happen.
1 Like