我的包装函数缺少变量?

My wrapper function is missing a variable?

本文关键字:变量 包装 函数 我的      更新时间:2023-10-16

由于我遇到的一个特殊错误,我决定像这样包装一个函数来解决上述错误:

UFUNCTION()         
void OnBoxOverlapWrapper(UPrimitiveComponent* /*ignored*/, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherIndex, bool bFromSweep, const FHitResult & SweepResult)
{
OnBoxOverlap(OtherActor, OtherComp, OtherIndex, bFromSweep, SweepResult);
}

但是,当我尝试编译我的代码时,设置 OnBoxOverlapWrapper 的行会产生以下内容:Error: Missing variable name。这是唯一一次在函数中声明包装器,因此不应发生这种情况。特别奇怪的是,当我对另一个函数使用类似的包装器时,它并没有产生这样的错误:

UFUNCTION()
void OnBoxEndOverlapWrapper(UPrimitiveComponent* /*ignored*/ AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherIndex)
{
OnBoxEndOverlap(OtherActor, OtherComp, OtherIndex);
} //this code does not produce an error

这是怎么回事?

事实证明,您需要为OnBoxOverlap函数编写一个主体。