UE4 Editor Crash - C++ SetCollisionResponseToChannel

Regardless of where I put this line of code…

GetOwner()->FindComponentByClass()->SetCollisionResponseToChannel(ECC_CoinObject, ECR_Ignore);

the editor crashes on me. Essentially, I’m trying to tell the player to ignore the coin in the game when it collides with it. I call this line of code when the player overlaps with the coin. I call a simple collect animation on the coin when the player collides with it. I also play a 2D sound and add points to the player’s score, but when the coin is still in the middle of its animation, the player can still collect it (replaying the sound and adding too much to the score), so I thought telling the player to ignore the coin would stop this, yet I still get crashes. I also get crashes when I do it the other way around (telling the collided coin to ignore pawn). Any suggestions?

Just quickly guessing its something along the line of what had happened with this person here https://answers.unrealengine.com/questions/407121/engine-crashes-when-setcollisionresponsetochannel.html that is a possible UE code problem of which they do have plenty of problems if you thought you were the only one :smile:

Am sure you can come up with a different thing to do that would avoid calling that function or avoid it in a way that causes a crash and burn. Or you can put it to UE4 Answerhub and see what someone - if even one of the devs - says about it.

Of course, if you’re not on the latest UE4 engine version as this course suggested to not use thus far, it could also be that it won’t have the problem on that newer version.

But if you are making a call to 3rd party whatever (in this case UE) and that crashes then either it has a problem or has a problem from how you’re trying to do things outside of that call if that makes any sense (it could be that just re-working how you do things can fix it and nothing else might).

Find component of what class? You haven’t specified.

Never mind everyone! I solved the problem. When I was trying to ignore the pawn through the overlapped coin, the actual player didn’t have its collision presets set to “Pawn”. Therefore, the collision couldn’t be ignored. Simple mistake. Thanks anyways!

Also, the component I found was of type “UStaticMeshComponent”, but when I copied the line of code in, that wasn’t included.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms