Destroying radialforcecomponent does nothing

here’s my blueprint

I would expect this to destroy the radialforcecomponent after creating it, but what it does in game is create it and leave it there permanently.

Hi cerdom,

Have you been able to reproduce this in a blank project with no additional content? Additionally, how are you testing to see each radial force component?

I’ll try to repro it when I have time (exam/homework crunch time right now), but I was making an ability that pushed other characters away for a quick duration in a multiplayer first person project. I originally programmed it to add a force component and delete it after a delay, but I found destroying it didn’t actually get rid of it and I would continue to push other characters around. Even programming it so the component would be destroyed immediately (as in my picture) did not do so. I compromised by reducing the force to 0 after the same duration and it works as I would expect it to.

It could have something to do with the fact that I’m adding it through a playercontroller and not the character it’s added to, but I don’t think it would matter. Maybe it’s not replicating that it’s being destroyed or something, but I’ll experiment as you suggested and give you a better bug report when I can.

Try doing a cast to to the player character then destroying the component. That should help with being able to destroy it after the fact. So, your blueprint should go:

Create RadialForceComponent>Cast to “PlayerCharacter”>Destroy object (radialforcecomponent).

However, what I would suggest is actually creating this in the character and using a cast to to access it from the player controller instead. That way you can create and destroy it within the character script and just access that function from the controller instead of trying to do it all in the controller and access variables of the character.

I will do some more messing around, but in the meantime, am I wrong to assume that my blueprint should destroy the component? Or because the controller is trying to destroy it, does it not work? The tooltip on destroy component kind of made it sound that way, but I was usually able to do stuff like this in the controller. A lot of my code is kind of stupidly in the controller when it should be in the character which you helped me realize. I’ll test it and get back to you once I’m done with my exams. Thanks.

Hi cerdom,

The controller is best used for situations in which you are trying to control the players movement or you have control specific information for multiple characters. The character is best used for spawning/using items, setting individual stats such as health, etc.