MaxSearchDependencyDepth

MaxSearchDependencyDepth

#Overview

name: MaxSearchDependencyDepth

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 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MaxSearchDependencyDepth is to control the depth of dependency searches in the Reference Viewer and Plugin Reference Viewer tools within Unreal Engine 5. It limits how deep the system will search for dependencies when analyzing asset or plugin relationships.

This setting variable is primarily used by the Asset Manager Editor plugin and the experimental Plugin Reference Viewer plugin. These tools are part of Unreal Engine’s editor subsystem, specifically for asset and plugin management.

The value of this variable is set in multiple ways:

  1. It can be configured through the engine’s configuration files, as indicated by the UPROPERTY(config) attribute in the UReferenceViewerSettings class.
  2. It can be modified programmatically using the SetSearchDependencyDepthLimit function in the UReferenceViewerSettings class.
  3. In the Plugin Reference Viewer, it can be changed through the UI, which triggers the lambda functions that update the Settings.MaxSearchDependencyDepth value.

This variable interacts with other settings in the Reference Viewer, such as bLimitSearchBreadth, which together control the scope of dependency searches.

Developers should be aware that:

  1. Setting this value too high might result in performance issues for large projects with complex dependency trees.
  2. A value of 0 or negative will be clamped to 0, effectively disabling the depth limit.
  3. Changes to this value may trigger a rebuild of the reference graph in the Plugin Reference Viewer.

Best practices when using this variable include:

  1. Start with a reasonable default value (like 1 or 2) and increase it only if necessary.
  2. Consider the size and complexity of your project when adjusting this value.
  3. Use in conjunction with other search limiting options (like bLimitSearchBreadth) for better control over search performance and results.
  4. When changing the value programmatically, consider whether to save the configuration (bSaveConfig parameter in SetSearchDependencyDepthLimit) based on whether the change should persist.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:972, section: [/Script/AssetManagerEditor.ReferenceViewerSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Editor/AssetManagerEditor/Source/AssetManagerEditor/Private/ReferenceViewer/ReferenceViewerSettings.cpp:160

Scope (from outer to inner):

file
function     int32 UReferenceViewerSettings::GetSearchDependencyDepthLimit

Source code excerpt:

int32 UReferenceViewerSettings::GetSearchDependencyDepthLimit() const
{
	return MaxSearchDependencyDepth;
}

void UReferenceViewerSettings::SetSearchDependencyDepthLimit(int32 NewDepthLimit, bool bSaveConfig)
{
	MaxSearchDependencyDepth = FMath::Max(NewDepthLimit, 0);
	if (bSaveConfig)
	{
		SaveConfig();
	}
}

#Loc: <Workspace>/Engine/Plugins/Editor/AssetManagerEditor/Source/AssetManagerEditor/Public/ReferenceViewer/ReferenceViewerSettings.h:129

Scope (from outer to inner):

file
class        class UReferenceViewerSettings : public UObject

Source code excerpt:

	/* How deep to search dependanies */
	UPROPERTY(config)
	int32 MaxSearchDependencyDepth; 
	
	/* Whether or not to limit how many siblings can appear */
	UPROPERTY(config)
	bool bLimitSearchBreadth;
	
	/* The max number of siblings that can appear from a node */

#Loc: <Workspace>/Engine/Plugins/Experimental/PluginReferenceViewer/Source/PluginReferenceViewer/Private/SPluginReferenceViewer.cpp:562

Scope (from outer to inner):

file
function     int32 SPluginReferenceViewer::GetSearchDependencyDepthCount

Source code excerpt:

int32 SPluginReferenceViewer::GetSearchDependencyDepthCount() const
{
	return Settings.MaxSearchDependencyDepth;
}

TSharedRef<SDockTab> SPluginReferenceViewer::SpawnTab_ReferenceGraph(const FSpawnTabArgs& Args)
{
	TSharedRef<SDockTab> SpawnedTab = SNew(SDockTab)
	[

#Loc: <Workspace>/Engine/Plugins/Experimental/PluginReferenceViewer/Source/PluginReferenceViewer/Private/SPluginReferenceViewer.cpp:707

Scope (from outer to inner):

file
lambda-function

Source code excerpt:

									.OnValueChanged_Lambda([this] (int32 NewValue)
										{	
											if (NewValue != Settings.MaxSearchDependencyDepth)
											{
												Settings.MaxSearchDependencyDepth = NewValue;
												bNeedsGraphRebuild = true;
											}
										}
									)
									.OnValueCommitted_Lambda([this] (int32 NewValue, ETextCommit::Type CommitType) 
										{ 
											FSlateApplication::Get().SetKeyboardFocus(GraphEditorPtr, EFocusCause::SetDirectly); 

											if (NewValue != Settings.MaxSearchDependencyDepth || bNeedsGraphRebuild)
											{
												Settings.MaxSearchDependencyDepth = NewValue;
												bNeedsGraphRebuild = false;
												RebuildGraph();
											}
										}
									)
									.MinValue(0)

#Loc: <Workspace>/Engine/Plugins/Experimental/PluginReferenceViewer/Source/PluginReferenceViewer/Private/SPluginReferenceViewer.h:105

Scope (from outer to inner):

file
class        class SPluginReferenceViewer : public SCompoundWidget

Source code excerpt:

	{
		int32 MaxSearchReferencersDepth = 1;
		int32 MaxSearchDependencyDepth = 1;
		bool bIsCompactMode = false;
		bool bShowDuplicates = true;
		bool bShowEnginePlugins = true;
		bool bShowOptionalPlugins = true;
	};