# SetCollisionResponseToChannels not working unless clicked in editor

**URL:** <https://forums.unrealengine.com/t/setcollisionresponsetochannels-not-working-unless-clicked-in-editor/386735>\
**Category:** World Creation\
**Tags:** linetrace, unreal-engine, Collision, UE4, question, CPP\
**Created:** [March 2, 2017, 1:30pm UTC](https://forums.unrealengine.com/t/setcollisionresponsetochannels-not-working-unless-clicked-in-editor/386735 "2017-03-02T13:30:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![WASDMagician](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WASDMagician](https://forums.unrealengine.com/u/WASDMagician)\
**Post date:** [March 2, 2017, 1:30pm UTC](https://forums.unrealengine.com/t/setcollisionresponsetochannels-not-working-unless-clicked-in-editor/386735/1 "2017-03-02T13:30:17Z")

</div>

Hi, I’m having a problem with setting the collision response on a UStaticMeshComponent.

I have a video of the problem [here](https://screencast-o-matic.com/watch/cbeVYO6Z5R) and the code I’m using is:

```
void AWeapon_Button::Set_Mesh(UStaticMeshComponent * _incoming_mesh, UStaticMeshComponent * _outgoing_mesh)
{
	_outgoing_mesh->SetWorldRotation(_incoming_mesh->GetComponentRotation());
	_outgoing_mesh->SetWorldLocation(_incoming_mesh->GetComponentLocation());
	_outgoing_mesh->StaticMesh = _incoming_mesh->StaticMesh;

	FCollisionResponseContainer collision_response;
	collision_response.SetAllChannels(ECollisionResponse::ECR_Block);
	_outgoing_mesh->SetCollisionResponseToChannels(collision_response);
}

```

The problem I have is that after I set the collision response the object doesn’t react (to a line trace in this instance) as it should.

If I go into the editor and look at the objects collision values they _have_ changed to block but the only way to have it actually by my line trace is to click on one of the checkboxes in the collision settings, I don’t actually need to change any values, the act of clicking on one of the checkboxes makes it work, when I go back into the game it works as it should.

So far I think it’s something that PretEditChange does but I don’t know what.

---

<div class="post-metadata">

**Author:** ![Naios](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Naios](https://forums.unrealengine.com/u/Naios)\
**Post date:** [July 8, 2022, 12:05am UTC](https://forums.unrealengine.com/t/setcollisionresponsetochannels-not-working-unless-clicked-in-editor/386735/2 "2022-07-08T00:05:19Z")

</div>

I encountered the same issue where setting the response for a specific channel did not take effect unless set in the editor. I solved it by re-creating the physics state for the Primitive Component (Primitive-\>RecreatePhysicsState()).
