This question regards the “Standalone Game” launch option from editor, not the actual standalone build of the game. Does it have it’s own name or abbreviation?
It’s quite confusing. I say “Testing standalone from editor” and “testing in a packaged build”, more verbose but less likely to run into confusion.
Blueprint subsystems
Hello, creating blueprint WorldSubsystems is indeed unsupported. They should be kept native and you should be wary of inheritance, because detected native UWorldSubsystem classes are automatically created so long as their implementation of ShouldCreateSubsystem returns true, so it’s very easy to run into redundant subsystems being created unless parent classes return false there.
Blueprint subsystems aren’t supported because blueprint assets are loaded late (unlike modules which are immediately loaded), and because blueprints can be recompiled at any time. We haven’t made work of extending the subsystems to support that.
Ensuring certain assets are loaded when playing Standalone
“Is there a way to solve this automatically? E.g. marking an asset type as always loaded in Standalone game?”
As you noticed, hard referencing them from another loaded asset works. GameInstance, GameMode BP, the map’s WorldSettings etc. Other methods include:
- A hard reference in a custom UDeveloperSettings subclass that you can set in Project Settings and which are saved in INI files. Note that a hard reference to a BP asset here does mean the asset will be loaded very early on application startup, which is when settings are loaded from INI files.
- Hardcoding an asset path in a UObject constructor. An example of this is in the ThirdPersonTemplate’s GameMode class:
AThirdPerson55RGameMode::AThirdPerson55RGameMode() { // set default pawn class to our Blueprinted character static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("/Game/ThirdPerson/Blueprints/BP_ThirdPersonCharacter")); if (PlayerPawnBPClass.Class != NULL) { DefaultPawnClass = PlayerPawnBPClass.Class; } }
Since you mention you made the WorldSubsystem a blueprint in order to reference some data assets, I would recommend either the FObjectFinder approach if the data asset can be hardcoded, or referencing the data assets by introducing a custom UDeveloperSettings with blueprint editable fields via Project Settings. Then your native WorldSubsystem class can read them out from GetDefault<UMyDeveloperSettings>().
If the assets must be discoverable (“find all assets of class X”) then configuring the asset type in Asset Manager in Project Settings is the way to go. You would include some asset folders to scan for those assets, then an UAssetManager call to scan them (ScanPathsForPrimaryAssets) + retrieve results (GetPrimaryAssetDataList) at runtime. Some info on that here and here. Discoverable assets aren’t automatically loaded, but you after retrieving them you can choose to async load them.
Does this answer your questions?