UnityEditor.AvatarPreview.IsValidPreviewGameObject C# (CSharp) Méthode

IsValidPreviewGameObject() public static méthode

public static IsValidPreviewGameObject ( GameObject target, ModelImporterAnimationType requiredClipType ) : bool
target UnityEngine.GameObject
requiredClipType ModelImporterAnimationType
Résultat bool
        public static bool IsValidPreviewGameObject(GameObject target, ModelImporterAnimationType requiredClipType)
        {
            if ((target != null) && !target.activeSelf)
            {
                Debug.LogWarning("Can't preview inactive object, using fallback object");
            }
            return ((((target != null) && target.activeSelf) && GameObjectInspector.HasRenderableParts(target)) && ((requiredClipType == ModelImporterAnimationType.None) || (GetAnimationType(target) == requiredClipType)));
        }

Usage Example

Exemple #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);
        }
All Usage Examples Of UnityEditor.AvatarPreview::IsValidPreviewGameObject