250328 TIL

박소희·2025년 3월 28일

Unity_7기

목록 보기
57/94

유니티 내에서 파일을 옮길 때 액세스 거부가 뜰 때가 있는데

  • visual studio를 끄고 다시 시도해보면 해결된다.

몬스터 객체가 여러 개 있을 때 state변환이 안된다..

  • stateMachine이 공유 되고 있는 건지 확인해야한다.
  • 생성된 stateMachine의 hashCode를 확인한 결과 다 동일한 hashCode였다. -> 공유되고 있음
  • StateMachine 클래스가 상속받고 있던 MonoBehaviour을 삭제하여 해결하였다.

chasingState -> attackState로 변환이 안된다..

  • NavmeshAgent를 사용해서 공격할 수 있는 거리를 계산하기로 했다.
    protected bool IsInAttackRange()
    {
        if (stateMachine.Monster.Agent == null) return false;

        float remainDistance = stateMachine.Monster.Agent.remainingDistance;
        float stoppingDistance = stateMachine.Monster.Agent.stoppingDistance;
        
        return remainDistance <= stoppingDistance || remainDistance <= stateMachine.Monster.AttackRange;
    }

Layout Component는 메모리를 많이 차지한다.. 몰랐어
-> 최적화 필요

작업표시줄 클릭이 안되고, alt + tab이 안될 때 window키를 연타하면 해결된다🤭

0개의 댓글