Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/129.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ OnOverlapBegin_的实现方式与OnOverlapBegin有何区别?_C++_Unreal Engine4_Unrealscript - Fatal编程技术网

C++ OnOverlapBegin_的实现方式与OnOverlapBegin有何区别?

C++ OnOverlapBegin_的实现方式与OnOverlapBegin有何区别?,c++,unreal-engine4,unrealscript,C++,Unreal Engine4,Unrealscript,我搞不懂这是怎么回事 UFUNCTION(BlueprintNativeEvent,类别=冲突) OverlapBegin无效(UPrimitiveComponent*Comp、AActor*otherActor、UPrimitiveComponent*otherComp、int32 otherBodyIndex、bool bFromSweep、const fHirtResult和SweepResult) 及 虚拟void on overlappeagin_实现(UPrimitiveCompon

我搞不懂这是怎么回事

UFUNCTION(BlueprintNativeEvent,类别=冲突) OverlapBegin无效(UPrimitiveComponent*Comp、AActor*otherActor、UPrimitiveComponent*otherComp、int32 otherBodyIndex、bool bFromSweep、const fHirtResult和SweepResult)

虚拟void on overlappeagin_实现(UPrimitiveComponent*Comp, AActor*otherActor,UPrimitiveComponent*otherComp,int32 otherBodyIndex, bool bFromSweep、const fHirtResult和SweepResult)


工作。

本质上,这是一个关于
BlueprintNativeEvent
函数说明符的问题。因此,上面的顶级函数定义将位于类的头文件中

UFUNCTION(BlueprintNativeEvent, Category = Collision) 
void OnOverlapBegin(UPrimitiveComponent* Comp, AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);

由于该函数说明符,函数被一个蓝图类所覆盖,它是定义该函数的任何C++类的子类。现在,这里的关键字是意思是。因此,蓝图覆盖此功能在技术上是可选的。但是,函数仍然可以被蓝图或C++类中的其他地方使用。因此,如果没有上述函数的重写版本,则使用函数的默认实现。您可以在头文件中定义默认方法,并在您的问题的下半部分中使用签名实现C++文件中的方法。

virtual void OnOverlapBegin_Implementation(UPrimitiveComponent* Comp, AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
尽管如此,我相信您甚至不需要在头文件中定义这个函数来实际实现这个函数。所以你可以直接进入C++类,实现默认的< OnOverlapBegin > <代码>函数,如,

void RandomClass::OnOverlapBegin_Implementation(UPrimitiveComponent* Comp, AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) 
{
    // called if not overridden by blueprint or subclass
}
单击以获取有关虚幻引擎中接口的更多信息


单击,并获取有关BlueprintNativeEvent函数说明符的更多信息。

本质上,这是一个关于
BlueprintNativeEvent
函数说明符的问题。因此,上面的顶级函数定义将位于类的头文件中

UFUNCTION(BlueprintNativeEvent, Category = Collision) 
void OnOverlapBegin(UPrimitiveComponent* Comp, AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);

由于该函数说明符,函数被一个蓝图类所覆盖,它是定义该函数的任何C++类的子类。现在,这里的关键字是意思是。因此,蓝图覆盖此功能在技术上是可选的。但是,函数仍然可以被蓝图或C++类中的其他地方使用。因此,如果没有上述函数的重写版本,则使用函数的默认实现。您可以在头文件中定义默认方法,并在您的问题的下半部分中使用签名实现C++文件中的方法。

virtual void OnOverlapBegin_Implementation(UPrimitiveComponent* Comp, AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
尽管如此,我相信您甚至不需要在头文件中定义这个函数来实际实现这个函数。所以你可以直接进入C++类,实现默认的< OnOverlapBegin > <代码>函数,如,

void RandomClass::OnOverlapBegin_Implementation(UPrimitiveComponent* Comp, AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) 
{
    // called if not overridden by blueprint or subclass
}
单击以获取有关虚幻引擎中接口的更多信息

单击,并获取有关BlueprintNativeEvent函数说明符的更多信息