bShouldManagerDetermineTypeAndName

bShouldManagerDetermineTypeAndName

#Overview

name: bShouldManagerDetermineTypeAndName

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bShouldManagerDetermineTypeAndName is to control whether the Asset Manager should automatically determine the primary asset type and name for objects that don’t have their own implementation of GetPrimaryAssetId.

This setting variable is primarily used by the Unreal Engine’s Asset Management system, specifically within the UAssetManager class and UAssetManagerSettings. It’s part of the Engine module and affects how primary asset IDs are determined for game objects.

The value of this variable is set in the project’s configuration files, typically in DefaultEngine.ini or a similar config file. It can be modified through the Project Settings in the Unreal Editor, under the “Asset Manager” category.

This variable interacts closely with the FCoreUObjectDelegates::GetPrimaryAssetIdForObject delegate. When bShouldManagerDetermineTypeAndName is true, this delegate is bound to the UAssetManager::DeterminePrimaryAssetIdForObject function.

Developers should be aware that enabling this setting allows the Asset Manager to automatically determine primary asset IDs for objects. This can be helpful for maintaining consistency in asset identification, but it may also override custom implementations if not used carefully.

Best practices when using this variable include:

  1. Consider enabling it if you want a centralized, consistent method for determining primary asset IDs across your project.
  2. If enabled, ensure that the DeterminePrimaryAssetIdForObject function in your AssetManager subclass (if you have one) correctly handles all your asset types.
  3. Be cautious when enabling this in projects that have existing custom GetPrimaryAssetId implementations, as it may override them.
  4. Use in conjunction with bShouldGuessTypeAndNameInEditor for better handling of legacy content in the editor.
  5. Remember to call ReinitializeFromConfig if you change this setting at runtime to ensure the change takes effect.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultGame.ini:53, section: [/Script/Engine.AssetManagerSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/AssetManager.h:416

Scope: file

Source code excerpt:

	ENGINE_API virtual void GetPreviousPrimaryAssetIds(const FPrimaryAssetId& NewId, TArray<FPrimaryAssetId>& OutOldIds) const;

	/** If bShouldManagerDetermineTypeAndName is true in settings, this function is used to determine the primary asset id for any object that does not have it's own implementation. Games can override the behavior here or call it from other places */
	ENGINE_API virtual FPrimaryAssetId DeterminePrimaryAssetIdForObject(const UObject* Object) const;

	/** Reads AssetManagerSettings for specifically redirected asset paths. This is useful if you need to convert older saved data */
	UE_DEPRECATED(5.1, "Asset path FNames are deprecated, use FSoftObjectPath instead.")
	ENGINE_API virtual FName GetRedirectedAssetPath(FName OldPath) const;
	ENGINE_API virtual FSoftObjectPath GetRedirectedAssetPath(const FSoftObjectPath& OldPath) const;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/AssetManagerSettings.h:101

Scope (from outer to inner):

file
class        class UAssetManagerSettings : public UDeveloperSettings

Source code excerpt:

	 */
	UPROPERTY(config, EditAnywhere, Category = "Asset Manager")
	bool bShouldManagerDetermineTypeAndName;

	/**
	 * If true, PrimaryAsset Type/Name will be implied for assets in the editor even if bShouldManagerDetermineTypeAndName is false.
	 * This guesses the correct id for content that hasn't been resaved after GetPrimaryAssetId was implemented
	 */
	UPROPERTY(config, EditAnywhere, Category = "Asset Manager")
	bool bShouldGuessTypeAndNameInEditor;

	/** If true, this will query the platform chunk install interface to request missing chunks for any requested primary asset loads */
	UPROPERTY(config, EditAnywhere, Category = "Asset Manager")
	bool bShouldAcquireMissingChunksOnLoad;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManager.cpp:435

Scope (from outer to inner):

file
function     void UAssetManager::PostInitProperties

Source code excerpt:

		bShouldUseSynchronousLoad = IsRunningCommandlet();

		if (Settings.bShouldManagerDetermineTypeAndName)
		{
			FCoreUObjectDelegates::GetPrimaryAssetIdForObject.BindUObject(this, &UAssetManager::DeterminePrimaryAssetIdForObject);
		}

		LoadRedirectorMaps();

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetManager.cpp:4706

Scope (from outer to inner):

file
function     void UAssetManager::ReinitializeFromConfig

Source code excerpt:

		FCoreUObjectDelegates::GetPrimaryAssetIdForObject.Unbind();
	}
	if (Settings.bShouldManagerDetermineTypeAndName)
	{
		FCoreUObjectDelegates::GetPrimaryAssetIdForObject.BindUObject(this, &UAssetManager::DeterminePrimaryAssetIdForObject);
	}

	LoadRedirectorMaps();
	ScanPrimaryAssetTypesFromConfig();