static public GameObject FindBestFittingRenderableGameObjectFromModelAsset(Object asset, ModelImporterAnimationType animationType) { if (asset == null) { return(null); } ModelImporter importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(asset)) as ModelImporter; if (importer == null) { return(null); } string assetPath = importer.CalculateBestFittingPreviewGameObject(); GameObject tempGO = AssetDatabase.LoadMainAssetAtPath(assetPath) as GameObject; // We should also check for isHumanClip matching the animationclip requiremenets... if (IsValidPreviewGameObject(tempGO, ModelImporterAnimationType.None)) { return(tempGO); } else { return(null); } }
public static GameObject FindBestFittingRenderableGameObjectFromModelAsset(UnityEngine.Object asset, ModelImporterAnimationType animationType) { GameObject result; if (asset == null) { result = null; } else { ModelImporter modelImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(asset)) as ModelImporter; if (modelImporter == null) { result = null; } else { string assetPath = modelImporter.CalculateBestFittingPreviewGameObject(); GameObject gameObject = AssetDatabase.LoadMainAssetAtPath(assetPath) as GameObject; if (AvatarPreview.IsValidPreviewGameObject(gameObject, ModelImporterAnimationType.None)) { result = gameObject; } else { result = null; } } } return(result); }
public static GameObject FindBestFittingRenderableGameObjectFromModelAsset(UnityEngine.Object asset, ModelImporterAnimationType animationType) { if (asset != null) { ModelImporter atPath = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(asset)) as ModelImporter; if (atPath == null) { return(null); } GameObject target = AssetDatabase.LoadMainAssetAtPath(atPath.CalculateBestFittingPreviewGameObject()) as GameObject; if (IsValidPreviewGameObject(target, ModelImporterAnimationType.None)) { return(target); } } return(null); }
public static GameObject FindBestFittingRenderableGameObjectFromModelAsset(Object asset, ModelImporterAnimationType animationType) { if (asset == (Object)null) { return((GameObject)null); } ModelImporter atPath = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(asset)) as ModelImporter; if ((Object)atPath == (Object)null) { return((GameObject)null); } GameObject target = AssetDatabase.LoadMainAssetAtPath(atPath.CalculateBestFittingPreviewGameObject()) as GameObject; if (AvatarPreview.IsValidPreviewGameObject(target, animationType)) { return(target); } return((GameObject)null); }