Modifying a Mesh’s Collision via Blueprints in UE5

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.

Lazy Loaded Image

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.

Set Collision Profile Name Pins Explained

  • Target: Which actor/component should be targeted?
  • In Collision Profile Name: What should be set as the collision?

    The following default collision profiles can be manually entered into this pin:

  • NoCollision
  • BlockAll
  • OverlapAll
  • BlockAllDynamic
  • OverlapAllDynamic
  • IgnoreOnlyPawn
  • OverlapOnlyPawn
  • Pawn
  • Spectator
  • CharacterMesh
  • PhysicsActor
  • Destructible
  • InvisibleWall
  • InvisibleWallDynamic
  • Trigger
  • Ragdoll
  • Vehicle
  • UI

The same list can also be displayed under “Project Settings > Collisions” in the engine. Here, you can also create ‘Custom’ collision profiles.

What does ‘Get Collision Profile Name’ function do?

The ‘Get Collision Profile Name’ function can be used for debugging purposes.

‘Set Collision Profile Name’ function doesn’t work!

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:

  • Update Overlaps (Boolean)

What does ‘Update Overlaps (Boolean)’ do, and why might it be the reason that ‘Set Collision Profile Name’ seems not to work?

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.


So what does this all mean?

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.

(Optional Read) What’s the difference between ‘Set Collision Enabled’ function vs ‘Set Collision Profile Name’ function?

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

  • Enable Collision: You can turn collision on or off.
  • Disable Collision: You can completely disable all collision responses.
  • Query Only: Enables collision only for queries (like raycasts) but not for physics interactions.
  • Physics Only: Enables collision only for physics interactions but not for queries.

    Parameters that it can take:

  • NoCollision: Disables all collision.
  • QueryOnly: Enables collision for query (e.g., raycasts) but not physics interactions.
  • PhysicsOnly: Enables collision for physics interactions but not queries.
  • QueryAndPhysics: Enables collision for both query and physics interactions.

    The ‘Set Collision Profile Name’ Function’s Usage Cases

  • Assign a Profile: You can set predefined collision profiles which encapsulate a set of collision settings.
  • Custom Profiles: Allows for the use of custom collision profiles created in the project settings.

    Key Differences

  • Set Collision Enabled offers finer control over the specific types of collision (query vs. physics), while Set Collision Profile Name sets a broad range of collision settings defined by a profile.
  • Set Collision Profile Name uses predefined profiles, which can simplify the management of collision settings across multiple objects. Set Collision Enabled is more flexible for situations where you need specific types of collision enabled or disabled without changing the entire profile.
  • Set Collision Enabled is typically used when you need to dynamically enable or disable collision types based on gameplay conditions, although it’s common to use ‘Set Collision Profile Name’ function to achieve the same result.
  • Set Collision Profile Name is useful when you want to apply a consistent set of collision settings to an object, especially when those settings need to be reused across multiple objects or components.

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!