UCLASS()
class FLIGHTSIMULATOR_API UFLYGameInstance : public UGameInstance
{
GENERATED_BODY()
public:
UFLYGameInstance();
virtual void StartGameInstance() override;
virtual void Shutdown() override;
virtual void Init() override;
protected:
};
extern FLIGHTSIMULATOR_API class UFLYGameInstance* GGameInstance;
FLIGHTSIMULATOR_API UFLYGameInstance* GGameInstance = nullptr;
UFLYGameInstance::UFLYGameInstance()
{
GGameInstance = this;
}
给暴露出去并赋值
UGameplayStatics::GetAllActorsOfClass(GGameInstance->world, AMyActor::StaticClass(), outputAc);
其他类就直接拿到用了