- Home /
How do I get the importer userData of another asset?
I'm working on an importer for a custom asset type that requires references to other assets, at least outside of the Unity environment (more specifically, they're basically string paths).
In my ScriptedImporter class, I have data that I parse from the import process:
public ClydeDatImporterData metadata {
get {
if (String.IsNullOrEmpty(userData))
userData = JsonConvert.SerializeObject(new ClydeDatImporterData());
return JsonConvert.DeserializeObject<ClydeDatImporterData>(userData);
}
set { userData = JsonConvert.SerializeObject(value); }
}
Unfortunately, ScriptedImporter's ScriptedImporter.userData scope is local to the current asset. Is it possible to access another asset's userData without parsing its respective [filename].[ext].meta file using Unity's own internal API?
Just as an aside, do you really want to be serialising and deserialising that data every time you access it?
I cache it in another variable first and then save (set this value) when I'm done with operations.
Your answer
Follow this Question
Related Questions
Editor class "Texture Importer" + Apply import settings question 6 Answers
AudioClip generated by an external process and loaded into the editor has no samples 1 Answer
Audio Importer: how do you override platform specific settings from code? 1 Answer
Batch import terrain with editor scripts 1 Answer
Auto switch max size of a selected texture in Project window 0 Answers