Any alternate to destroying a component?

I have a pickup item, it has a collision.

When collision overlaps character, character picks up item.

When character spawns item, I destroy the collision component immediately through a “exposed on spawn” variable so that the item stays in character’s hand instead of turning into a pickup again.

I want to be able to drop the item. One way would be to use a BPI and tell dropped item to spawn a collision and painstakingly set all of it’s transforms, physics and collision values each time the item is dropped so it becomes a pickup again.

I wanted a simpler solution where I wouldn’t have to destroy the component. Deactivate doesn’t work.

I’m confused on what you are destroying. In my projects my pickups are separate blueprint actors from the held actors. Are you attaching the pickup itself to the character? By your wording it seems like the pickup is destroyed once picked up, then respawned as the same actor but without pickup functionality.
If this is the case I’d suggest to you that your pickups are separate classes from your held items. This way whenever you want to drop the item it’s as simple as destroying the held item actor and spawning the pickup actor.

But keeping them the same makes my code much simpler. All I have to do is disable/destroy the collision and it works dandy n fine. I have a LOT of items and don’t want to go around creating replicas of each item that does nothing besides act as a pickup. I have it working the hard way where I just respawn the collisions and set their properties. I just wanted a cleaner way to do exactly that.

PS: I’m destroying the collision

Yeah if you already have quite the extensive system using it in this manner I’d say sadly the cleaner way means redoing a lot of that work. In the future you may want things to be separate actors in the case that they may need their own components that do not translate from a pickup to a held actor. You could make a single generic pickup actor with an expose on spawn/instance editable variable for Actor Class that points to the actor you pickup. The reason I have separate actors for all pickups is some of them have animations, particle effects, skeletal meshes vs. static meshes. If that isn’t necessary to you the generic pickup actor should work. This way you just excise out the pickup related programming on your already created items (I hope you have a parent class). I assure you the cleaner, more manageable, option is what you should strive for even if it requires a small amount of ground-work.

well “clean” is a matter of perspective. What you find clean may not be clean for me. As I said, I find integrating the pickup functionality into the item actor to be a cleaner way than go around setting up twice the amount of actors than what’s needed.

Besides, your solution is to a question I didn’t ask. I need an alternate solution to destroying a component or a way to disable it. Not a rework for my inventory system.

Denying someone guiding you towards industry standards is probably not the go-to and not a good way to get help here. My answer solved your problem because you would not have had the problem in the first place. If you’re that pressed to do it this way just have a bool inside the actor that’s ‘bIsHeld’ and if that bool is true then do not execute anything related to the pickup logic. Setting collision channels and simulating physics etc. is something you will have to upkeep continuously since you want the blueprint to function as both.

Additionally, there are plenty of professionals in this forum and amongst the community and if they give you advice it shouldn’t be met with how you responded. Best of luck.

iNdUsTrY sTaNdArDs. Thank you for your input, I told you in my first reply that your solution is of no use to me. If you can’t provide a solution to the question asked and need to get offended by someone not using your methods, this is not the place to be for you…

Hey folks. Please try to remain civil, and if you find yourself clashing with someone on the forums, it’s best to avoid interaction with that individual and move on. Let’s keep the forums a civil, safe, and productive environment for everyone!

Thanks! :slight_smile:

sorry about that.