개발/Unity
문제해결)You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
테샤르
2022. 9. 7. 09:33
You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
해당이슈는 MonoBehaviour를 상속받는 클래스를 new 키워드로 생성할 경우에 발생하는 Warning 이다.
반응형
해결방법은 다음과 같다.
1. MonoBehaviour를 제거하는 방법 (구조의 변경)
2. new 키워드가 아닌 AddComponent를 통해서 생성하는 방법
★☆☆☆☆
반응형