기타/Unreal
[Unreal Error] Destroy()가 false를 반환하는 경우
푸쿠이
2021. 4. 29. 17:50
참고 문서
forums.unrealengine.com/t/what-causes-destroy-to-return-false-fail/148465
What causes Destroy() to return false? (Fail)
I’ve been stuck on this for a couple of days. I have a blueprint actor that refuses to be deleted. Not just in code, but in the editor also. When I click play and the actor is spawned in, I F8 out and click the actor, and hit delete. The console output s
forums.unrealengine.com
상황
C++로 간단한 코드를 짰다.
Box 클래스에서 부딪힌 Item을 Destroy했는데, Destroy함수가 False를 반환하면서 작동을 안하는 것이다!!
// 박스에 아이템이 부딪히면,
// 부딪힌 아이템 삭제! 했는데, 삭제가 안 돼!
OverlappedItem->Destroy();
해결
Item 클래스의 BeginPlay 함수에서 Super::BeginPlay()를 빼먹었다. ㅎㅎ
void AMyInteractiveItem::BeginPlay()
{
Super::BeginPlay(); // 어떻게 이걸 까먹었지!!!
}
원인
언리얼에서 알아서 해주나보다.
사실 Override한 가상 함수에서 Super 클래스를 불러주는 것에 대해 너무 소홀했다.
중요하게 생각하지 않고, 귀찮다고만 생각했다.
Super 클래스에서 많은 것을 대신 해주나보다. Override했으면 까먹지말자!!
안 적으면 오류라도 내줘야 하는 거 아닌가?? ㅠㅠ
언리얼 에디터의 출력 로그에 아무런 말도 없다.