HomeSystem plugins › AFS_Core_Loading
System

AFS_Core_Loading

Level flow: the level data asset, game mode, transition actors, player start positions and the libraries that switch levels in editor, listen-server and client contexts.

What it gives you

  • One data asset describing a level's game mode, pawns and maps
  • Correct level switching in editor, on a listen server and on clients
  • Customisable loading transitions
  • Indexed player start positions for multiplayer

Requires

AFM_CameraFade AFM_Teleport AFS_UI

Required by

AFE_Showroom AFU_Intro

12 assets39 API members

Description

PDA_Level is the centre of this plugin. It names the game mode, the pawn class per platform, the persistent map, any streaming maps, the transition actor and a minimum transition time. Because the pawn decision lives here rather than in the map, the same map can serve VR, desktop and mobile.

ML_Loading.Loading_SwitchLevel handles the three cases that usually get written three times: in the editor it fades and calls OpenLevel; with authority it fades every player and issues a servertravel; on a client it fades and opens locally.

FL_Loading caches the active level data asset in the object registry subsystem, so any Blueprint can ask what level it is in without a hard reference.

Setup

See Create a new level for the full walkthrough.

  1. Create a PDA_Level and fill in the game mode, pawn classes and maps.
  2. Place a BP_MapInfo actor in the map pointing at the data asset.
  3. Place BP_PlayerPosition actors as spawn points; mark one Default Position.

Usage

Switching level

Call ML_Loading.Loading_SwitchLevel with the target PDA_Level. Pass Listen Server true when the host should stay listening.

Customising the loading screen

Derive from BP_Transition, override StartLoading and LoadingFinished, and set your class as Transition Class on the level data asset.

Finding the current level

Call FL_Loading.getLevelInfo from anywhere.

Key properties

PropertyWhen to change
Pawn SelectForce Desktop while iterating; Dynamic for shipping
Min Transition TimeRaise to avoid a jarring flash when loading is fast
Streaming MapsFill only when you actually stream; a non-empty list triggers the loading transition
Player Index / Default PositionOn BP_PlayerPosition, for multiplayer spawn assignment

Extending

Derive from BP_Transition for custom loading visuals, and implement BPI_PlayerPosition to make your own actor a valid spawn point.

Multiplayer notes

Multiplayer

Level switching on a listen server uses servertravel so all clients follow. bUseSeamlessTravel is enabled on the shipped game mode.

Example map

Map_Examples_Lobby switches between every other example map using this system.

Troubleshooting

The wrong pawn spawns. Pawn Select is set to a Force option, or the map has no BP_MapInfo.

Level switch does nothing in the editor. The editor path strips the play-in-editor prefix via getLevelPathFromReference; a manually built travel URL will not.

API reference

Every blueprint asset in this plugin. Expand an asset to see its members.

Blueprints/MapInfo

BP_MapInfo1 members
extends Actor
KindNameSignatureDescription
varLevelKeyInfoPDA_LevelThe level data asset describing this map. Place one Map Info actor per level so any Blueprint can discover the level's configuration.

Blueprints/PlayerPosition

BP_PlayerPosition7 members
extends PlayerStart · implements BPI_PlayerPosition
KindNameSignatureDescription
varPlayerIndexParameterintWhich player this start position belongs to. Positions are claimed in order, so give each start a distinct index for multiplayer.
varDefaultPositionParameterboolMarks this as the fallback start used when no position matches the joining player's index.
varUse FadeSettingsE_Teleport_FadeWhether teleporting a player to this position fades the camera.
fnFindFreeIndexParameter()Claims the next unused player index for this position.
eventOnTeleportFinished_Event(Pawn: Pawn)Internal handler fired once a pawn has finished teleporting to this position.
eventPlayerPosition_TeleportToPosition(Pawn: Pawn)Teleports the given pawn to this start position.
eventPlayerPosition_PawnSpawnedHere(Pawn: Pawn)Called when a pawn spawns at this position, so the start can run any arrival logic.

Blueprints/Transition

BP_Transition2 members
extends Actor
KindNameSignatureDescription
eventLoadingFinished()Called when loading completes and the minimum transition time has elapsed. Override to dismiss your loading visuals.
eventStartLoading()Called when loading begins. Override in a subclass to show your own loading visuals.
BP_Transition_Default2 members
extends BP_Transition
KindNameSignatureDescription
eventLoadingFinished()Fades out the default loading screen and destroys the transition actor.
eventStartLoading()Shows the default loading screen and begins its animation.

DataAssets

PDA_Level11 members
extends PrimaryDataAsset
KindNameSignatureDescription
varGameModePawnClass<GameMode>Game mode loaded with this level. Passed on the travel URL so it applies to networked travel as well.
varPawnSelectPawnE_Pawn_SelectHow the pawn is chosen. Dynamic detects VR, then mobile, then desktop; the Force options override that for testing.
varDefault_Pawn_DesktopPawnClass<Pawn>Pawn class possessed when the level is entered on a desktop machine. Only consulted when Pawn Select resolves to desktop; leave it empty and the level loads with no pawn on that platform.
varDefault_Pawn_VRPawnClass<Pawn>Pawn class spawned when a head-mounted display is present.
varDefault_Pawn_MobilePawnClass<Pawn>Pawn class spawned on iOS and Android.
varNameInformationtextDisplay name for this level, shown in navigation and loading UI.
varTransitionClassTransitionClass<BP_Transition>Transition actor spawned while streaming maps load. Subclass it to customise the loading screen.
varMinTransitionTimeTransitionfloatShortest time the loading screen stays up, in seconds. Prevents a jarring flash when loading is fast.
varPersistantMapStreaming LevelSoftWorldReferenceThe map opened immediately when switching to this level.
varStreamingMapsStreaming LevelSoftWorldReference[]Maps streamed in after the persistent map opens. If this list is non-empty a loading transition is shown while they load.
fngetPawnToSpawn(out PawnToSpawn: Class<Pawn>)Resolves which pawn class to spawn, applying the Pawn Select rule against the current platform.

Game

BP_GameMode0 members
extends GameMode

No editor-visible members; this asset configures defaults only.

Helper

BP_Helper_Pawn_Loading8 members
extends Pawn
KindNameSignatureDescription
fnRequiresLoading(out RequiresLoading: bool)Returns whether this level still has streaming maps to load before gameplay can begin.
fnFindStartingPlayerPosition(PlayerIndex: int, out PlayerPosition: Actor)Finds the player start matching the given index, falling back to the default position.
eventServer_ControllerReady(Controller: PlayerController)Tells the server this client's controller is ready, so the real pawn can be spawned.
eventClient_LoadLevels(Level: PDA_Level)Instructs this client to stream in the level's maps and show the transition while it happens.
eventControllerChanged(OldController: Controller, NewController: Controller)Internal handler that reacts to this placeholder pawn being possessed or unpossessed.
eventServer_LoadLevelInfo()Asks the server for the level data asset so the client knows what to load.
eventCheckForUnpossess(Controller: Controller)Checks whether this placeholder pawn is still needed and destroys it once the real pawn has taken over.
eventServer_DestroyPawn()Asks the server to destroy this placeholder pawn.

Interfaces

BPI_PlayerPosition5 members
extends Interface
KindNameSignatureDescription
fnPlayerPosition_getSpawnTransformPlayer Position(out Transform: Transform)Returns the transform a pawn should spawn at for this position.
fnPlayerPosition_getIndexPlayer Position(out Index: int)Returns the player index this position is reserved for.
fnPlayerPosition_IsDefaultPlayer Position(out Default: bool)Returns whether this is the fallback position used when no index matches.
fnPlayerPosition_TeleportToPositionPlayer Position(Pawn: Pawn)Teleports the given pawn to this position.
fnPlayerPosition_PawnSpawnedHerePlayer Position(Pawn: Pawn)Notifies the position that a pawn has spawned there.

Libraries

FL_Loading3 members
extends BlueprintFunctionLibrary
KindNameSignatureDescription
fngetLevelInfoLevelInfo(const Context: Object, __WorldContext: Object, out Level: PDA_Level)Returns the level data asset for the current level, reading it from the object registry and falling back to the Map Info actor placed in the map.
fnsetLevelInfoLevel Info(Context: Object, Level: PDA_Level, __WorldContext: Object)Stores the level data asset in the object registry so later lookups avoid searching the level.
fngetLevelPathFromReferenceLevel(const Level: SoftObject<World>, __WorldContext: Object, out LevelPath: name)Converts a soft world reference into a travel path, stripping the editor play-in-editor prefix so server travel works from the editor.
ML_Comp_Loading0 members
extends ActorComponent

No editor-visible members; this asset configures defaults only.

ML_Loading0 members
extends Actor

No editor-visible members; this asset configures defaults only.

Widgets

WBP_Loading0 members
extends WBP_Base

No editor-visible members; this asset configures defaults only.