1 ConstructorHelpers::FClassFinder,ConstructorHelpers::FObjectFinder加载蓝图,此方法得放在构造函数中加载,蓝图资源路径需要copy Reference后加_C,FClassFinder<T>,T为父类名,加载蓝图类并创建actor用 GetWorld()->SpawnActor,此函数不能放在构造函数,放beginplay.
,
实例:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"
UCLASS()
class MYPROJECT8_API AMyActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AMyActor();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void T