Coding Memo

[AddressableAssets] SBP ErrorError 본문

Unity

[AddressableAssets] SBP ErrorError

minttea25 2023. 9. 6. 15:01

Addressable Asset을 사용하고 있는 프로젝트를 빌드 시 발생하는 에러

SBP ErrorError

 

해결방법

스크립트가 정상적으로 컴파일 되는지 확인

(디버그 창에 SBP ErrorError 이후 좀 더 내려보면 어떤 오류가 있는지 추가적으로 나올 때도 있으니 확인하고 그것부터 해결하면 된다.)

 

에디터에서 실행했을 때는 잘 실행 되었는데 빌드 시 오류?

=> 스크립트 내에 프로그램 실행 시에 사용하지 않는 namespace나 참조 등이 있는지 확인

=> 예를 들어 UnityEditor.Editor 등의 네임스페이스는 말그대로 에디터에서만 사용가능하고 빌드 시에는 참조할 수 없는 네임스페이스다.

만약 Editor 등의 클래스를 사용하였다면, 사용한 코드에 대해서 조건부 컴파일을 지정해주어야 한다.

#if UNITY_EDITOR
// codes => 이 부분이 빌드 시 컴파일에 포함되어 있으면 안된다.
#else
// codes
#end

 

나의 경우에도 Editor를 이용해서 custom editor를 만든 코드가 있었는데, Editor를 상속받아 사용한 클래스를 `if UNITY_EDITOR`로 조건부 컴파일을 건 뒤에 다시 빌드를 하니 해결되었다.

 

Editor에서만 사용되는 코드는 반드시 조건부 컴파일을 사용하여 빌드 시 컴파일 문제가 없도록 하자.

 


Reference

https://forum.unity.com/threads/failed-to-compile-player-scripts-sbp-error-when-building-addressables.966739/

 

Resolved - Failed to compile player scripts / SBP Error when building Addressables.

For a while now, when I try to build Addressables it give me both "Failed to compile player scripts" and "SBP Error" and not build them. They work fine...

forum.unity.com

 

'Unity' 카테고리의 다른 글

Unity에서 UnityWebRequest 사용 시, 에러 (Curl error60) (localhost, loopback)  (2) 2024.07.16
Coroutine 실행 에러  (0) 2023.12.22
SerializedObject  (1) 2023.05.12
Unity Tip - UI 최적화 1  (0) 2023.05.08
Unity .gitignore 관련  (0) 2022.08.02