UE中Actor的头文件和在编辑器细节面板编辑的特性

Unreal Engine 在编辑器细节面板编辑的特性
UPROPERTY(EditAnywhere)
float Angle = 0.0f;

UE中常用源文件.h:
#include “GameFramework/Actor.h”//引用游戏框架的演员Actor的源文件库
#include “Engine/TriggerVolume.h”//引用引擎的触发区域TriggerVolume的源文件库
#include “Engine/World.h”//引用引擎的世界World的源文件库

// Fill out your copyright notice in the Description page of Project Settings.
//这是一个C++的 .h文件,用来定义变量、函数和引入头文件(命名空间?)
#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "GameFramework/Actor.h"//引用游戏框架的演员Actor的源文件库
#include "Engine/TriggerVolume.h"//引用引擎的触发区域TriggerVolume的源文件库
#include "Engine/World.h"//引用引擎的世界World的源文件库
#include "OpenDoor.generated.h"


UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class PROJECT02_API UOpenDoor : public UActorComponent
{
    
    
	GENERATED_BODY()

public:
	// Sets default values for this component's properties
	UOpenDoor();

protected:
	// Called when the game starts
	virtual void BeginPlay() override;

public:
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
	//可以在细节面板访问
	UPROPERTY(EditAnywhere)
	float Angle = 0.0f;   //定义公有的变量
	//可以开门的区域
	UPROPERTY(EditAnywhere)
	ATriggerVolume *TriggerArea = nullptr;//开门触发区域,默认空指针类型
	UPROPERTY(EditAnywhere)
	AActor *ActorThatOpen = nullptr;//开门的指针,默认空

private:
	//定义私有的函数方法名字,在C++的.cpp文件中去实现它们
	void OpenDoor();
	void CloseDoor();


};

猜你喜欢

转载自blog.csdn.net/weixin_43834973/article/details/141970274