TrackRenderAsset

TrackRenderAsset

#Overview

name: TrackRenderAsset

This variable is created as a Console Variable (cvar).

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of TrackRenderAsset is to add a render asset (such as a texture or mesh) to the list of assets being tracked by Unreal Engine’s streaming system.

This setting variable is primarily used in the content streaming subsystem of Unreal Engine. Based on the callsites, it’s primarily referenced in the Engine module, specifically in the content streaming and texture streaming management components.

The value of this variable is set when the TrackRenderAsset function is called. It’s typically invoked through console commands or programmatically when developers want to start tracking specific assets for streaming purposes.

TrackRenderAsset interacts with other variables and functions in the streaming system, notably:

Developers should be aware of several things when using this variable:

  1. It’s used for both textures and meshes, as evidenced by the TrackTexture function that calls TrackRenderAsset.
  2. The tracking is case-insensitive, but the full asset name should be provided for accuracy.
  3. This functionality may be conditionally compiled, as seen in the #else block where a dummy implementation is provided.

Best practices when using this variable include:

  1. Use it judiciously, as tracking too many assets could impact performance.
  2. Ensure that assets you want to track are actually used in your game and benefit from streaming management.
  3. Regularly review and update the list of tracked assets as your project evolves.
  4. Use in conjunction with other streaming settings for optimal performance.
  5. Consider using the console commands for debugging and testing purposes, but implement programmatic tracking for production builds.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ContentStreaming.cpp:150

Scope (from outer to inner):

file
function     bool TrackRenderAsset

Source code excerpt:

 * @return				true if the name was added
 */
bool TrackRenderAsset( const FString& AssetName )
{
	if ( GConfig && AssetName.Len() > 0 )
	{
		for ( int32 TrackedAssetIndex=0; TrackedAssetIndex < GTrackedRenderAssetNames.Num(); ++TrackedAssetIndex)
		{
			const FString& TrackedAssetName = GTrackedRenderAssetNames[TrackedAssetIndex];

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ContentStreaming.cpp:172

Scope (from outer to inner):

file
function     bool TrackTexture

Source code excerpt:

bool TrackTexture(const FString& TextureName)
{
	return TrackRenderAsset(TextureName);
}

/**
 * Removes a texture/mesh name from being tracked in the streaming system and updates the .ini setting.
 * The name must match an existing tracking name, but isn't case-sensitive.
 *

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ContentStreaming.cpp:327

Scope (from outer to inner):

file
function     bool TrackRenderAsset

Source code excerpt:

}
#else
bool TrackRenderAsset(const FString& AssetName)
{
	return false;
}
bool TrackTexture( const FString& TextureName )
{
	return TrackRenderAsset(TextureName);
}
bool UntrackRenderAsset(const FString& AssetName)
{
	return false;
}
bool UntrackTexture( const FString& TextureName )

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:90

Scope: file

Source code excerpt:

	ECVF_Default);

bool TrackRenderAsset( const FString& AssetName );
bool UntrackRenderAsset( const FString& AssetName );
void ListTrackedRenderAssets( FOutputDevice& Ar, int32 NumTextures );

/**
 * Helper function to clamp the mesh to camera distance
 */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:2365

Scope (from outer to inner):

file
function     bool FRenderAssetStreamingManager::HandleTrackRenderAssetCommand

Source code excerpt:


	FString AssetName(FParse::Token(Cmd, 0));
	if ( TrackRenderAsset(AssetName) )
	{
		Ar.Logf(TEXT("Textures or meshes containing \"%s\" are now tracked."), *AssetName);
	}
	return true;
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Streaming/StreamingManagerTexture.cpp:2934

Scope (from outer to inner):

file
function     bool FRenderAssetStreamingManager::Exec

Source code excerpt:

	}
	else if (FParse::Command(&Cmd,TEXT("TrackTexture"))
		|| FParse::Command(&Cmd, TEXT("TrackRenderAsset")))
	{
		return HandleTrackRenderAssetCommand( Cmd, Ar );
	}
	else if (FParse::Command(&Cmd,TEXT("ListTrackedTextures"))
		|| FParse::Command(&Cmd, TEXT("ListTrackedRenderAssets")))
	{