IsValidPreviewGameObject() публичный статический Метод

public static IsValidPreviewGameObject ( GameObject target, ModelImporterAnimationType requiredClipType ) : bool
target UnityEngine.GameObject
requiredClipType ModelImporterAnimationType
Результат bool
Пример #1
0
        private static GameObject CalculatePreviewGameObject(Animator selectedAnimator, Motion motion, ModelImporterAnimationType animationType)
        {
            AnimationClip firstAnimationClipFromMotion = AvatarPreview.GetFirstAnimationClipFromMotion(motion);
            GameObject    gameObject = AvatarPreviewSelection.GetPreview(animationType);

            if (AvatarPreview.IsValidPreviewGameObject(gameObject, ModelImporterAnimationType.None))
            {
                return(gameObject);
            }
            if (selectedAnimator != null && AvatarPreview.IsValidPreviewGameObject(selectedAnimator.gameObject, animationType))
            {
                return(selectedAnimator.gameObject);
            }
            gameObject = AvatarPreview.FindBestFittingRenderableGameObjectFromModelAsset(firstAnimationClipFromMotion, animationType);
            if (gameObject != null)
            {
                return(gameObject);
            }
            if (animationType == ModelImporterAnimationType.Human)
            {
                return(AvatarPreview.GetHumanoidFallback());
            }
            if (animationType == ModelImporterAnimationType.Generic)
            {
                return(AvatarPreview.GetGenericAnimationFallback());
            }
            return(null);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }