1. 创建和设置
创建继承自 GameInstance 的C++类
头文件里加上
UCLASS(BlueprintType, Blueprintable)
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Engine/GameInstance.h"
#include "MyGameInstance.generated.h"
/**
*
*/
UCLASS(BlueprintType, Blueprintable)
class EXERCISE_API UMyGameInstance : public UGameInstance
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
float health = 10.0f;
};