public static void RecursiveGetTransformDependecies(AAssetImporter importer, XmlNode root) { XmlNode childrenNode = root.SelectSingleNode("Children"); if (childrenNode != null) { XmlNodeList childrenNodeList = childrenNode.ChildNodes; for (int i = 0; i < childrenNodeList.Count; i++) { string type = childrenNodeList[i].SelectSingleNode("Type").InnerText; if (type == "MESH" || type == "LIGHT" || type == "CAMERA") { string path = childrenNodeList[i].SelectSingleNode("Prefab").InnerText; importer.AddDependency <GameObject>(path); } SmallImporterUtils.RecursiveGetTransformDependecies(importer, childrenNodeList[i]); } } }
void OnPreprocessAsset() { // During this phase we create the needed assets without linking them together AAssetImporter importer = GetAssetImporter(assetPath); if (importer != null) { if (!_importers.ContainsKey(assetPath)) { importer.CreateDependencies(assetPath); SmallLogger.Log(SmallLogger.LogType.AssetPostProcessor, "Importing asset: " + Path.GetFileName(assetPath) + " with " + importer.DependencyCount + (importer.DependencyCount == 1 ? " dependency" : " dependencies")); importer.OnPreImport(assetPath); _importers.Add(assetPath, importer); } else { SmallLogger.LogError(SmallLogger.LogType.AssetPostProcessor, "Asset already in the list : " + assetPath); } } }