[유니티] 유니티 컴포넌트 추가 오류
[유니티] 유니티 컴포넌트 추가 오류
에러:유니티 컴포넌트 추가가 안될 때
게임 스크립트를 드래그해서 컴포넌트로 추가할 때 다음와 같은 오류 메시지가 나온다.
Can’t add script
Can’t add script component ‘MyBall’ because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.
해결방법
게임 스크립트명과 스크립트의 클래스명이 다르면 해당 오류가 나온다. 클래스 이름이 다르면 컴포넌트로 인식하지 못한다.
파일명을 test로 바꾸거나, 클래스명을 MyBall로 바꾼다.
파일명이나 클래스명을 바꾼 후에 다시 컴포넌트로 추가하면 인식이 된다.
This post is licensed under CC BY 4.0 by the author.