반응형
CS0246은 빌드 타임시 나는 에러이다.
다음과 같이 해결할 수 있다.
#if UNITY_EDITOR
// Unity Editord에서 사용할 코드
#else
// 런타임 시에 사용할 코드
#endif
ex) 예제 코드
#if UNITY_EDITOR using UnityEditor; // UnityEditor namespace도 에러가 나게 된다. #endif #if UNITY_EDITOR namespace MyNameSpace { [CustomEditor(typeof(someClass))] public class MyCustomInspector : Editor { // Custom Editor를 만들기 위해 Editor를 상속받게 되면 빌드타임시 CS0246 에러가 나게 된다. // 다음과 같이 #if #endif 로 막아주면 에러가 사라진다. } } #endif |
반응형
'Programing > Unity' 카테고리의 다른 글
Unity & OpenGL How to use openGL in unity. 유니티에서 격자(Grid) 그리기 (0) | 2020.02.19 |
---|---|
Multi Threading in unity (0) | 2020.02.16 |