CollisionChannelRedirects
CollisionChannelRedirects
#Overview
name: CollisionChannelRedirects
The value of this variable can be defined or overridden in .ini config files. 12
.ini config files referencing this setting variable.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of CollisionChannelRedirects is to handle the renaming of collision channels in Unreal Engine 5. This variable is part of the collision system and is used to maintain backwards compatibility when collision channel names are changed.
This setting variable is primarily used by the Engine module, specifically within the collision system. It’s defined in the UCollisionProfile class, which is part of the Engine’s collision management system.
The value of this variable is set in the global configuration files and can be modified through the project settings or programmatically. It’s populated in the LoadProfileConfig function and can be updated using the AddChannelRedirect function.
CollisionChannelRedirects interacts with the CollisionChannelRedirectsMap, which is an internal map used to store the redirects in memory for quick access. When changes are made to the redirects, both the array and the map are updated to maintain consistency.
Developers must be aware that modifying this variable can have far-reaching effects on the project’s collision system. Changes to collision channel names should be carefully managed to avoid breaking existing gameplay logic or level designs.
Best practices when using this variable include:
- Always use the provided functions (like AddChannelRedirect) to modify the redirects, rather than directly manipulating the array.
- Keep track of any channel redirects in your project documentation to maintain clarity for the development team.
- After adding or modifying redirects, ensure that all relevant collision profiles are updated to reflect the changes.
- Be cautious when renaming collision channels in shipping projects, as it may affect saved data or networked gameplay.
- Use meaningful names for both old and new channel names to maintain code readability and ease future maintenance.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2896, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="Static",NewName="WorldStatic")
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:2897, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="Dynamic",NewName="WorldDynamic")
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:2898, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="VehicleMovement",NewName="Vehicle")
- Is Array:
True
Location: <Workspace>/Engine/Config/BaseEngine.ini:2899, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="PawnMovement",NewName="Pawn")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:224, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="Static",NewName="WorldStatic")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:225, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="Dynamic",NewName="WorldDynamic")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:226, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="VehicleMovement",NewName="Vehicle")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:227, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="PawnMovement",NewName="Pawn")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:228, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="Static",NewName="WorldStatic")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:229, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="Dynamic",NewName="WorldDynamic")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:230, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="VehicleMovement",NewName="Vehicle")
- Is Array:
True
Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:231, section: [/Script/Engine.CollisionProfile]
- INI Section:
/Script/Engine.CollisionProfile
- Raw value:
(OldName="PawnMovement",NewName="Pawn")
- Is Array:
True
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/CollisionProfile.h:181
Scope (from outer to inner):
file
class class UCollisionProfile : public UDeveloperSettings
Source code excerpt:
/** Used to handle renaming collision channels */
UPROPERTY(globalconfig)
TArray<FRedirector> CollisionChannelRedirects;
public:
/** default property name for no collision - this is very popular **/
static ENGINE_API const FName NoCollision_ProfileName;
static ENGINE_API const FName BlockAll_ProfileName;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Collision/CollisionProfile.cpp:222
Scope (from outer to inner):
file
function void UCollisionProfile::AddChannelRedirect
Source code excerpt:
NewValue = NewName;
CollisionChannelRedirects.Empty();
// now add back to it
TArray<FString> KeyValues;
for(auto Iter=CollisionChannelRedirectsMap.CreateConstIterator(); Iter; ++Iter)
{
const FName &Key = Iter.Key();
const FName &Value = Iter.Value();
CollisionChannelRedirects.Add(FRedirector(Key, Value));
}
// if change collision channel redirect, it will requires for all profiles to refresh that data
for(auto Iter=Profiles.CreateIterator(); Iter; ++Iter)
{
SaveCustomResponses(*Iter);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Collision/CollisionProfile.cpp:528
Scope (from outer to inner):
file
function void UCollisionProfile::LoadProfileConfig
Source code excerpt:
CollisionChannelRedirectsMap.Empty();
for(auto Iter = CollisionChannelRedirects.CreateConstIterator(); Iter; ++Iter)
{
FName OldName = Iter->OldName;
FName NewName = Iter->NewName;
// at least we need to have OldName
if(OldName!= NAME_None && NewName != NAME_None)