Skip to content

Extending Subsystems to Customize Integration

There are three primarily layers that can be extended in the RallyHere Unreal Integration:

  • The actual subsystems URH_GameInstanceSubsystem and URH_LocalPlayerSubsystem
  • The Subsystem plugins (originally Subsystems of their own, and generally named as such) such as URH_CatalogSubsystem and URH_PlayerInfoSubsystem
  • The plugin subobjects such as URH_PlayerInfo and URH_PlayerInventory

Extending Subsystems

To extend the URH_GameInstanceSubsystem and URH_LocalPlayerSubsystem classes, you’ll need to create a new class that inherits from the base class and override the virtual functions you want to extend. They will automatically detect if a subclass exists during startup, and if so will not instantiate themselves so that the subclass will be used instead.

UCLASS()
class RHEXAMPLEGAME_API UMyPlayerSubsystem : public URH_LocalPlayerSubsystem
{
GENERATED_BODY()
};
UCLASS()
class RHEXAMPLEGAME_API UMyGameInstanceSubsystem : public URH_GameInstanceSubsystem
{
GENERATED_BODY()
};

Extending Subsystem Plugins

To extend the subsystem plugins, make a subclass of the plugin class that inherits from the base class. Then in the Plugin Settings (available in editor or directly by editing the INI), set the class to use to the new subclass.

UCLASS()
class UMyCatalogSubsystem : public URH_CatalogSubsystem
{
GENERATED_BODY()
public:
UMyCatalogSubsystem(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer)
{
}
};

Once compiled, launch the Unreal Editor and navigate to Edit → Project Settings....

Under the Plugins section in the left pane of the window, select Rally Here Integration Settings, then scroll down in the right pane to the Subsystem Classes section.

Set the Catalog Subsystem Class to MyCatalogSubsystem.

Extending Subobjects

Primary subobjects may have configurable overrides directly in the settings (such as URH_PlayerInfo).

However, within some subobjects, such as URH_PlayerInfo there may be helper subojects as well. For these, standard Unreal Engine subobject class overriding via FObjectInitializer is respected.

For example, if we wanted to add custom behavior to the URH_PlayerInventory subobject of URH_PlayerInfo, we’d create three classes:

UCLASS()
class UMyPlayerInventory : public URH_PlayerInventory
{
GENERATED_BODY()
public:
UMyPlayerInventory(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer)
{
}
};
UCLASS()
class UMyPlayerInfo : public URH_PlayerInfo
{
GENERATED_BODY()
public:
UMyPlayerInfo(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer.SetDefaultSubobjectClass<UMyPlayerInventory>(TEXT("PlayerInventory")))
{
}
};

Once compiled, launch the Unreal Editor and navigate to Edit → Project Settings....

Under the Plugins section in the left pane of the window, select Rally Here Integration Settings, then scroll down in the right pane to the Subsystem Classes section.

Set the Player Info Class to MyPlayerInfo.