Visual Studio 2015 Enterpriseを使用してUnreal Engine 4.13.2およびC++を学習しています。override invalidatorを使用したメソッドで基底クラスメソッドが無効化されていません
私の問題はC++だと思うので、質問するのに最適な場所はここにあります。
私はAActorクラスから継承するC++クラスを持っています。私はAActorからメソッドをオーバーライドする必要がありますので、私はこれをヘッダファイルに入れています:
virtual void ReceiveHit(class UPrimitiveComponent* MyComp, class AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult& Hit);
また、私はcppファイルに実装しました。
しかし、私は、次のコンパイラエラーを取得:
MyActor.h(23): error C3668: 'MyActor::ReceiveHit': The method with the override invalidator did not invalidate any base class method
私はAActor.hファイルからReceiveHit
方法をコピーしたと私はそのエラーを取得します。
別のメソッドも問題なくオーバーライドされています。これはMyActor
ヘッダファイルです:
#pragma once
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"
UCLASS()
class MYGAME_API AMyActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AMyActor();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick(float DeltaSeconds) override;
virtual void ReceiveHit(class UPrimitiveComponent* MyComp, AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult& Hit) override;
private:
UProjectileMovementComponent* MyMovement;
};
どうすればこのエラーを修正できますか?
をhttps://docs.unrealengine.com/latest/INT/API/Runtime/([ドキュメント]によると、 Engine/GameFramework/AActor/ReceiveHit/index.html)関数は仮想ではないのでオーバーライドできません。 – UnholySheep
@UnholySheep多分私は古いチュートリアルに従っています。 – VansFannel
@UnholySheepこれを見てください:https://wiki.unrealengine.com/Reflecting_Projectile_C%2B%2B。ここでは、ReceiveHitは仮想として定義されています。だから、私はそれを実装するためにオーバーライドを使う必要はありませんか?私はSuper :: ReceiveHitを呼び出さなければなりませんか? – VansFannel