UE 踩坑记录
发表于2020-11-24
1. UE引擎崩溃
报错: UObject() constructor called but it's not the object that's currently being constructed with NewObject. Maybe you are trying to construct it on the stack, which is not supported.
原因: UObject不能直接调用构造函数. 在声明时应该使用指针, 然后再用CreateDefaultSubobject来创建
错误示例:
UDemoObject DemoObject;
正确示例:
UDemoObject* DemoObject;
DemoObject = CreateDefaultSubobject<UDemoObject>(TEXT("UDemoObject"));