AISystemClassName

AISystemClassName

#Overview

name: AISystemClassName

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 AISystemClassName is to specify the class name of the AI system to be created for a game world in Unreal Engine 5. This setting variable is crucial for the AI module and determines which AI system implementation will be used in the game.

The Unreal Engine subsystem that primarily relies on this setting variable is the AI Module, specifically within the runtime components of the engine. It’s used in the process of creating and initializing the AI system for a game world.

The value of this variable is typically set in the project settings or can be overridden in the World Settings for a specific level. It’s defined as a UPROPERTY with globalconfig and EditAnywhere attributes, allowing it to be configured both in code and through the Unreal Editor.

This variable interacts closely with the AISystemModuleName variable, which specifies the name of the module used to spawn the AI system. Together, these variables determine how the AI system is created and initialized.

Developers must be aware that:

  1. If AISystemClassName is not set or is invalid, no AI system will be created for the world.
  2. The class specified must be a subclass of UAISystemBase.
  3. Changing this value can have significant impacts on the game’s AI behavior and performance.

Best practices when using this variable include:

  1. Ensure the specified class exists and is properly implemented before setting it.
  2. Consider performance implications when choosing or changing the AI system class.
  3. Use the World Settings to override the global setting for specific levels if needed.
  4. Always test thoroughly after changing this setting, as it affects the entire AI system of the game.
  5. Coordinate with the entire development team when modifying this setting, as it can impact multiple aspects of the game.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3230, section: [/Script/Engine.AISystemBase]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/AIModule.cpp:114

Scope (from outer to inner):

file
function     UAISystemBase* FAIModule::CreateAISystemInstance

Source code excerpt:

	UE_LOG(LogAIModule, Verbose, TEXT("Creating AISystem for world %s"), *GetNameSafe(World));
	
	FSoftClassPath AISystemClassName = UAISystemBase::GetAISystemClassName();

	if (World)
	{
		AWorldSettings* WorldSettings = World->GetWorldSettings();
		if (WorldSettings)
		{
			AISystemClassName = WorldSettings->GetAISystemClassName();
		}
	}

	UAISystemBase* AISystemInstance = nullptr;
	if (AISystemClassName.IsValid())
	{
		TSubclassOf<UAISystemBase> AISystemClass = LoadClass<UAISystemBase>(nullptr, *AISystemClassName.ToString(), nullptr, LOAD_None, nullptr);

		AISystemInstance = AISystemClass ? NewObject<UAISystemBase>(World, AISystemClass) : nullptr;
		if (AISystemInstance == nullptr)
		{
			UE_LOG(LogAIModule, Error, TEXT("Failed to create AISystem instance of class %s!"), *AISystemClassName.ToString());
		}
	}

	return AISystemInstance;
}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/AI/AISystemBase.h:54

Scope (from outer to inner):

file
class        class UAISystemBase : public UObject

Source code excerpt:

	/** List of specific AI system class to create, can be game-specific */
	UPROPERTY(globalconfig, EditAnywhere, Category = "AISystem", noclear, meta = (MetaClass = "/Script/AIModule.AISystem", DisplayName = "AISystem Class"))
	FSoftClassPath AISystemClassName;

	/** Name of a module used to spawn the AI system. If not empty, this module has to implement IAISystemModule */
	UPROPERTY(globalconfig, EditAnywhere, Category = "AISystem", noclear, meta = (MetaClass = "/Script/AIModule.AISystem", DisplayName = "AISystem Module"))
	FName AISystemModuleName;

	FDelegateHandle OnMatchStateSetHandle;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/World.h:2411

Scope: file

Source code excerpt:

	/** AISystem getter. if AISystem is missing it tries to create one and returns the result.
	 *	@NOTE the result can be NULL, for example on client games or if no AI module or AISystem class have not been specified
	 *	@see UAISystemBase::AISystemClassName and UAISystemBase::AISystemModuleName*/
	UAISystemBase* CreateAISystem();

	/** AISystem getter */
	FORCEINLINE UAISystemBase* GetAISystem() { return AISystem; }
	/** AISystem const getter */
	FORCEINLINE const UAISystemBase* GetAISystem() const { return AISystem; }
	
	/** Avoidance manager getter */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AI/AISystemBase.cpp:20

Scope (from outer to inner):

file
function     FSoftClassPath UAISystemBase::GetAISystemClassName

Source code excerpt:

{
	UAISystemBase* AISystemDefaultObject = Cast<UAISystemBase>(StaticClass()->GetDefaultObject());
	return AISystemDefaultObject != NULL ? AISystemDefaultObject->AISystemClassName : FSoftClassPath();
}

void UAISystemBase::CleanupWorld(bool bSessionEnded, bool bCleanupResources, UWorld* NewWorld)
{
	CleanupWorld(bSessionEnded, bCleanupResources);
}