Class: USystemsSubsystem

class SYSTEMS_API USystemsSubsystem
    : public UGameInstanceSubsystem;

Reflection-enabled


Global accessible registry of systems worlds.

Architecture book page explains more in depth how to interact with systems subsystem, but in a brief: This is a registry of globally accessible systems worlds game can have at any time.

Example

UCLASS()
class EXAMPLE_API UExampleGameInstance : public UGameInstance
{
	GENERATED_BODY()

private:
	virtual void Init() override;
};

void UExampleGameInstance::Init()
{
	Super::Init();

	auto* Subsystem = USystemsSubsystem::Get(GetWorld());
	if (IsValid(Subsystem))
	{
		Subsystem->AcquireSystemsWorld(FName(),
			[&](auto& Systems)
			{
				Systems.RegisterComponent<UShiaComponent>();

				Systems.InstallResource<UShiaSettings>();

				Systems.InstallLambdaSystem(JustDoItSystem, FInstallSystemOptions("JustDoIt"));
			});
	}
}

Methods

  • AcquireSystemsWorld

    public:
    void AcquireSystemsWorld(
        FName Id,
        TFunction<SystemSetupFunctor> SetupFunctor
    );
    

    Create, setup and register new systems world.

    Example

    UCLASS()
    class EXAMPLE_API AExampleGameMode : public AGameModeBase
    {
    	GENERATED_BODY()
    
    private:
    	virtual void InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) override;
    
    	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
    };
    
    void AExampleGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
    {
    	Super::InitGame(MapName, Options, ErrorMessage);
    
    	auto* Subsystem = USystemsSubsystem::Get(GetWorld());
    	if (IsValid(Subsystem))
    	{
    		Subsystem->AcquireSystemsWorld(FName(),
    			[&](auto& Systems)
    			{
    				Systems.RegisterComponent<UShiaComponent>();
    
    				Systems.InstallResource<UShiaSettings>();
    
    				Systems.InstallLambdaSystem(JustDoItSystem, FInstallSystemOptions("JustDoIt"));
    			});
    	}
    }
    
    void AExampleGameMode::EndPlay(const EEndPlayReason::Type EndPlayReason)
    {
    	Super::EndPlay(EndPlayReason);
    
    	auto* Subsystem = USystemsSubsystem::Get(GetWorld());
    	if (IsValid(Subsystem))
    	{
    		Subsystem->ReleaseSystemsWorld(ThisClass::SYSTEMS_WORLD);
    	}
    }
    

    Arguments

    • Id

      FName Id
      

      Systems world ID.

    • SetupFunctor

      TFunction<SystemSetupFunctor> SetupFunctor
      

      Function/lambda that performs setup of created systems world.

      Note

      SystemSetupFunctor has given signature: void(USystemsWorld& Systems).

  • BlueprintAcquireSystemsWorld

    public:
    void BlueprintAcquireSystemsWorld(
        FName Id,
        FOnSetupSystemsWorld SetupDelegate
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = Systems|Subsystem

    Meta Specifiers:

    • DisplayName = Acquire Systems World

    Create, setup and register new systems world.

    Blueprint-side version of USystemsSubsystem::AcquireSystemsWorld.


    Arguments

    • Id

      FName Id
      

      Systems world ID.

    • SetupDelegate

      FOnSetupSystemsWorld SetupDelegate
      

      Delegate that performs setup of created systems world.

      Note

      This delegate has given signature: void(USystemsWorld* Systems).

  • Get

    public:
    static USystemsSubsystem* Get(
        UWorld* World
    );
    

    Gets instance of this subsystem.


    Arguments

    • World

      UWorld* World
      

      World context object.

  • GetSystemsWorld

    public:
    USystemsWorld* GetSystemsWorld(
        FName Id
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = Systems|Subsystem

    Meta Specifiers:

    • Displayname = Get Systems World

    Gets systems world by its label.


    Arguments

    • Id

      FName Id
      

      Systems world ID.

  • GetSystemsWorldsIds

    public:
    void GetSystemsWorldsIds(
        TSet<FName>& Output
    ) const;
    

    Gets list of all registered systems worlds IDs.

    Useful only for more advanced usecases like editor tools that might want to list currently existing systems world.


    Arguments

  • ReleaseSystemsWorld

    public:
    void ReleaseSystemsWorld(
        FName Id
    );
    

    Reflection-enabled

    Specifiers:

    • BlueprintCallable
    • Category = Systems|Subsystem

    Meta Specifiers:

    • Displayname = Release Systems World

    Unregister given systems world.

    Example

    UCLASS()
    class EXAMPLE_API AExampleGameMode : public AGameModeBase
    {
    	GENERATED_BODY()
    
    private:
    	virtual void InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) override;
    
    	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
    };
    
    void AExampleGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
    {
    	Super::InitGame(MapName, Options, ErrorMessage);
    
    	auto* Subsystem = USystemsSubsystem::Get(GetWorld());
    	if (IsValid(Subsystem))
    	{
    		Subsystem->AcquireSystemsWorld(FName(),
    			[&](auto& Systems)
    			{
    				Systems.RegisterComponent<UShiaComponent>();
    
    				Systems.InstallResource<UShiaSettings>();
    
    				Systems.InstallLambdaSystem(JustDoItSystem, FInstallSystemOptions("JustDoIt"));
    			});
    	}
    }
    
    void AExampleGameMode::EndPlay(const EEndPlayReason::Type EndPlayReason)
    {
    	Super::EndPlay(EndPlayReason);
    
    	auto* Subsystem = USystemsSubsystem::Get(GetWorld());
    	if (IsValid(Subsystem))
    	{
    		Subsystem->ReleaseSystemsWorld(ThisClass::SYSTEMS_WORLD);
    	}
    }
    

    Arguments

    • Id

      FName Id
      

Documentation built with Unreal-Doc v1.0.8 tool by PsichiX