Automation Tests using Subsystem

Hello,

In order to access a subsystem from an automated test, you first have to construct a game instance which will create the subsystem. Use the following code:

UMySubsystem* MySubsystemRef = NewObject<UGameInstance>()->GetSubsystem<UMySubsystem>();

This will create a gameinstance and get the subsystem from it. You may set the game instance to be your production game instance, or just use UGameInstance as that will create the subsystems the same way.

Hope this helps,
Patrick

2 Likes