net.iris.AllowAsyncLoading

net.iris.AllowAsyncLoading

#Overview

name: net.iris.AllowAsyncLoading

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of net.iris.AllowAsyncLoading is to control whether async loading is allowed when using the Iris replication system in Unreal Engine 5. This setting is part of the networking and replication system, specifically for the Iris experimental feature.

This setting variable is primarily used by the Iris replication system, which is an experimental module in Unreal Engine 5. It’s located in the Iris Core module, specifically within the ObjectReferenceCache component of the replication system.

The value of this variable is set through a console variable (CVar) system. It’s initialized to true by default but can be changed at runtime through console commands or configuration files.

This variable interacts closely with another boolean variable named bIrisAllowAsyncLoading. They share the same value, with the console variable (net.iris.AllowAsyncLoading) controlling the value of bIrisAllowAsyncLoading.

Developers must be aware that this setting alone is not sufficient to enable async loading. As noted in the comment, the net.allowAsyncLoading setting must also be enabled for async loading to work in the Iris replication system.

Best practices when using this variable include:

  1. Ensure that both net.iris.AllowAsyncLoading and net.allowAsyncLoading are set appropriately for your use case.
  2. Be cautious when disabling async loading, as it may impact performance in networked games.
  3. Test thoroughly with both async loading enabled and disabled to ensure your game functions correctly in both scenarios.

Regarding the associated variable bIrisAllowAsyncLoading:

The purpose of bIrisAllowAsyncLoading is to serve as an internal flag within the Iris replication system that reflects the value of the net.iris.AllowAsyncLoading console variable.

This variable is used directly in the FObjectReferenceCache::ShouldAsyncLoad() function to determine whether async loading should be performed. If bIrisAllowAsyncLoading is false, the function immediately returns false, preventing async loading.

The value of bIrisAllowAsyncLoading is set by the console variable system and is not meant to be modified directly in code.

Developers should be aware that this variable is used internally by the Iris replication system and should not be modified directly. Instead, they should use the net.iris.AllowAsyncLoading console variable to control async loading behavior in the Iris system.

Best practices for bIrisAllowAsyncLoading include:

  1. Treat it as a read-only variable in your code.
  2. Use the net.iris.AllowAsyncLoading console variable to indirectly control its value.
  3. When debugging issues related to async loading in the Iris system, check the value of this variable to confirm the current async loading state.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/ObjectReferenceCache.cpp:51

Scope (from outer to inner):

file
namespace    UE::Net::Private

Source code excerpt:


static bool bIrisAllowAsyncLoading = true;
FAutoConsoleVariableRef CVarIrisAllowAsyncLoading(TEXT("net.iris.AllowAsyncLoading"), bIrisAllowAsyncLoading, TEXT("Flag to allow or disallow async loading when using iris replication. Note: net.allowAsyncLoading must also be enabled."), ECVF_Default);

FObjectReferenceCache::FPendingAsyncLoadRequest::FPendingAsyncLoadRequest(FNetRefHandle InNetRefHandle, double InRequestStartTime)
: RequestStartTime(InRequestStartTime)
{
	NetRefHandles.Add(InNetRefHandle);
}

#Associated Variable and Callsites

This variable is associated with another variable named bIrisAllowAsyncLoading. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/ObjectReferenceCache.cpp:50

Scope (from outer to inner):

file
namespace    UE::Net::Private

Source code excerpt:

{

static bool bIrisAllowAsyncLoading = true;
FAutoConsoleVariableRef CVarIrisAllowAsyncLoading(TEXT("net.iris.AllowAsyncLoading"), bIrisAllowAsyncLoading, TEXT("Flag to allow or disallow async loading when using iris replication. Note: net.allowAsyncLoading must also be enabled."), ECVF_Default);

FObjectReferenceCache::FPendingAsyncLoadRequest::FPendingAsyncLoadRequest(FNetRefHandle InNetRefHandle, double InRequestStartTime)
: RequestStartTime(InRequestStartTime)
{
	NetRefHandles.Add(InNetRefHandle);
}

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Iris/Core/Private/Iris/ReplicationSystem/ObjectReferenceCache.cpp:1988

Scope (from outer to inner):

file
namespace    UE::Net::Private
function     bool FObjectReferenceCache::ShouldAsyncLoad

Source code excerpt:

bool FObjectReferenceCache::ShouldAsyncLoad() const
{
	if (!bIrisAllowAsyncLoading)
	{
		return false;
	}

	switch (AsyncLoadMode)
	{