Skip to content

Added virtual function to allow child classes to add startup jobs #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Source/GameBaseFramework/Private/Engine/GBFAssetManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ void UGBFAssetManager::AddStartupJob( const FString & job_name, const TFunction<
weight ) );
}

void UGBFAssetManager::AddStartupJobWithHandle( const FString & job_name, const TFunction< TSharedPtr< FStreamableHandle >() > & function, float weight )
{
StartupJobs.Add( FGBFAssetManagerStartupJob(
job_name,
[ this, function ]( const FGBFAssetManagerStartupJob & startup_job, TSharedPtr< FStreamableHandle > & load_handle ) {
load_handle = function();
},
weight ) );
}

void UGBFAssetManager::LoadGameData()
{
}
Expand All @@ -76,10 +86,16 @@ void UGBFAssetManager::StartInitialLoading()
},
1.0f );

PreDoStartupJobs();

// Run all the queued up startup jobs
DoAllStartupJobs();
}

void UGBFAssetManager::PreDoStartupJobs()
{
}

void UGBFAssetManager::InitializeGameplayCueManager()
{
SCOPED_BOOT_TIMING( "UGBFAssetManager::InitializeGameplayCueManager" );
Expand Down
2 changes: 2 additions & 0 deletions Source/GameBaseFramework/Public/Engine/GBFAssetManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ class GAMEBASEFRAMEWORK_API UGBFAssetManager : public UAssetManager
const GameDataClass & GetOrLoadTypedGameData( const TSoftObjectPtr< GameDataClass > & data_path );

void AddStartupJob( const FString & job_name, const TFunction< void() > & function, float weight );
void AddStartupJobWithHandle( const FString & job_name, const TFunction< TSharedPtr< FStreamableHandle >() > & function, float weight );
virtual void LoadGameData();
void StartInitialLoading() override;
virtual void PreDoStartupJobs();

private:
void InitializeGameplayCueManager();
Expand Down