Let’s say that, at some point in your gameplay, you want to remove the collision of an actor/component and bring it back whenever needed. One of the many ways to achieve this is by using the “Set Collision Profile Name” function.
In Unreal Engine 5, the ‘Set Collision Profile Name’ function changes the collision settings of an actor or component by assigning it a predefined collision profile.
The following default collision profiles can be manually entered into this pin:
The same list can also be displayed under “Project Settings > Collisions” in the engine. Here, you can also create ‘Custom’ collision profiles.
The ‘Get Collision Profile Name’ function can be used for debugging purposes.
If you search through Unreal Engine’s forums, you’ll see many topics discussing this issue, which is why I decided to write this post. If we check the description area above, you’ll notice that I skipped one feature that this function includes:
Let’s Start With What It Does:
The “Update Overlaps Boolean” plays a crucial role in how Unreal Engine updates collision overlaps when the collision profile is changed. When you change the collision profile of an actor or component, it can affect how that object interacts with other objects in terms of collisions and overlaps. The “Update Overlaps Boolean” option specifies whether the engine should update the overlapping state of this object with other objects in the scene immediately after the collision profile is changed.
When this option is set to true, the engine will recompute all overlaps for the actor or component immediately after the collision profile is updated. This means the engine will immediately check for new overlaps or end existing overlaps based on the new collision settings. This ensures that the actor’s overlap events are kept up-to-date and accurate according to the new collision profile.
When set to false, the engine will not immediately recompute overlaps. This can be useful if you are making multiple changes to the collision settings or profiles and want to delay/defer the overlap updates for performance and gameplay reasons, planning to handle them manually or in a batch process later.
If you have two collision boxes that are very close to each other, one that removes the collision, while the other sets the collision to let’s say ‘BlockAll’.
If you print this to the screen, you’ll notice that the channel value is repeatedly printed (You’ll see the same value printed multiple times, in other words.) because Unreal Engine keeps updating the overlaps.
A very high chance is that, you’ll find that despite setting the collision to ‘BlockAll’, after you set your mesh’s collision profile to ‘NoCollision’, your mesh’s collision profile remains stuck on ‘NoCollision’.
This is why you might also encounter an ‘Infinite Loop Detected!’ error if you fire ‘On Component Begin Overlap’ and ‘On Component End Overlap’ events right after another or with short delays. Unreal Engine continues to update and update and update… the overlaps without resolution.
Setting the ‘Update Overlaps (Boolean)’ to false will resolve this issue if you do not need profile collision naming for very complex systems.
In UE5, both of these “Set Collision Enabled” and “Set Collision Profile Name” functions are used to manage collision settings for actors or components.
The ‘Set Collision Enabled’ Function’s Usage Cases
Parameters that it can take:
The ‘Set Collision Profile Name’ Function’s Usage Cases
Key Differences
And that’s it! If you find my text-based tutorials helpful, you can support me on Patreon for just $10 a month. This support will help me to dedicate more time to writing these tutorials!