66 lines
3.1 KiB
C#
66 lines
3.1 KiB
C#
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// [임시 디버그용] 보스 오브젝트에 붙이고 Play하면
|
|||
|
|
/// 콘솔에 모든 AnimationClip 이름을 출력합니다.
|
|||
|
|
/// 확인 후 이 스크립트는 삭제하세요.
|
|||
|
|
/// </summary>
|
|||
|
|
public class AnimatorDebugDump : MonoBehaviour
|
|||
|
|
{
|
|||
|
|
private void Start()
|
|||
|
|
{
|
|||
|
|
Animator animator = GetComponent<Animator>();
|
|||
|
|
if (animator == null)
|
|||
|
|
{
|
|||
|
|
Debug.LogError("[AnimatorDebug] Animator 컴포넌트가 없습니다!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ═══════════════════════════════════════
|
|||
|
|
// 1) RuntimeAnimatorController의 모든 AnimationClip 이름
|
|||
|
|
// ═══════════════════════════════════════
|
|||
|
|
RuntimeAnimatorController rac = animator.runtimeAnimatorController;
|
|||
|
|
if (rac != null)
|
|||
|
|
{
|
|||
|
|
AnimationClip[] clips = rac.animationClips;
|
|||
|
|
Debug.Log($"══════ [AnimatorDebug] 총 클립 수: {clips.Length} ══════");
|
|||
|
|
for (int i = 0; i < clips.Length; i++)
|
|||
|
|
{
|
|||
|
|
Debug.Log($" 클립[{i}]: \"{clips[i].name}\" (길이: {clips[i].length:F2}초)");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Debug.LogWarning("[AnimatorDebug] RuntimeAnimatorController가 null입니다!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ═══════════════════════════════════════
|
|||
|
|
// 2) 현재 레이어 0의 State 이름 확인 (Play 직후)
|
|||
|
|
// ═══════════════════════════════════════
|
|||
|
|
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
|
|||
|
|
Debug.Log($"[AnimatorDebug] 현재 State nameHash: {stateInfo.shortNameHash}, 길이: {stateInfo.length:F2}초");
|
|||
|
|
|
|||
|
|
// ═══════════════════════════════════════
|
|||
|
|
// 3) 코드에서 사용 중인 애니메이션 이름들 존재 여부 테스트
|
|||
|
|
// ═══════════════════════════════════════
|
|||
|
|
string[] testNames = new string[]
|
|||
|
|
{
|
|||
|
|
"Idle", "Roar", "Walk", "Run",
|
|||
|
|
"Attack_Swing", "Attack_Slam", "Attack_Throw",
|
|||
|
|
"Skill_DashReady", "Skill_Dash", "Skill_JumpUp", "Skill_JumpDown",
|
|||
|
|
"Skill_Pickup", "GetDamage", "Die",
|
|||
|
|
// FBX 프리픽스 버전도 테스트
|
|||
|
|
"Armature|Idle", "Armature|Roar", "Armature|Walk",
|
|||
|
|
"Armature|Attack_Throw", "Armature|Skill_Pickup"
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
Debug.Log("══════ [AnimatorDebug] State 존재 여부 테스트 ══════");
|
|||
|
|
foreach (string name in testNames)
|
|||
|
|
{
|
|||
|
|
int hash = Animator.StringToHash(name);
|
|||
|
|
bool exists = animator.HasState(0, hash);
|
|||
|
|
string status = exists ? "✅ 존재" : "❌ 없음";
|
|||
|
|
Debug.Log($" \"{name}\" → {status}");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|