首页 > 解决方案 > 我的包装函数缺少一个变量?

问题描述

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

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

这里发生了什么?

标签: c++unreal-engine4

解决方案


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


推荐阅读