void BasicAssetOut.PickAssetAtPath <ElementType>(string path, Taker <ElementType> collector) { try { var contentFullPath = Path.GetDirectoryName(assetUnitInfo.localref) + "/" + path; if (typeof(ElementType) == (typeof(ModelImporter))) { var importer = (ElementType)(object)ModelImporter.GetAtPath(contentFullPath); collector.Take(importer); } else if (typeof(UnityEngine.Object).IsAssignableFrom(typeof(ElementType))) { try { foreach (var asset in AssetDatabase.LoadAllAssetsAtPath(contentFullPath)) { try { var concreteAsset = (ElementType)(object)asset; if (concreteAsset != null) { collector.Take(concreteAsset); break; } } catch { } } } catch { collector.OnFail("StdEditTimeUnityAssetIO.PickAssetAtPath: "); } } else { if (File.Exists(contentFullPath)) { collector.Take(RequiredFuncs.FromJsonAtPath <ElementType>(contentFullPath)); } } } catch (Exception e) { Debug.LogError(e); } collector.OnFinish(); }
void Taker <AssetInterface> .OnFail(string reason) { interfaceTaker.OnFail(reason); simpleListener.OnFail(reason); }