BP_Actor.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyMccActor.generated.h"
UCLASS()
class MYCPPPROJECT_API AMyMccActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AMyMccActor();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UFUNCTION(BlueprintImplementableEvent, Category = "SplineMesh")
void PrintMessage(const FString &Message);
};
Othre.cpp
void XXX::BeginPlay()
{
TArray<AActor*> _TempArryActors;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), AActor::GetClass(), _TempArryActors);
for (int32 i = 0; i < _TempArryActors.Num(); i++)
{
if (_TempArryActors[i]->GetName() == FString("AMyMccActor"))
{
Cast<AMySplineMeshActor>(_TempArryActors[i])->PrintMessage(TEXT("找到Actor&调用PringMessage函数"));
}
}
来源:CSDN
作者:Ning+
链接:https://blog.csdn.net/o0pk2008/article/details/104748753