Whenever I switch weapon I receive an error from the “Fire On” function (Fire screenshot) because they can’t communicate with the blueprint of the actor that just got destroyed, obviously. For spawning my weapons I have a child actor on my player and whenever I change weapons I simply spawn the new one and the old one gets automatically destroyed. Now I know this is what triggers the error, but I don’t know why. Is there any way to properly delete the actor so that the function won’t try to call it whenever I switch weapons? Or maybe there’s an error in my Fire blueprint and it doesn’t call the new weapon but still the old one?
IMO you shouldn’t destroy them if you’re going to use them again.
My approach is to create a obj reference in inventory for each weapon spawned. The current in use weapon is referenced via a “current weapon obj” reference var. Each time I switch a weapon I update that particular var, then use it for weapon data etc.
When I unequip (no weapon in hand) I set the var empty (nothing pinned).
e.g. Fire button pressed … current weapon → is valid → execute.
Weapons in my system are attached/holstered when not in use (visibly). For a setup like Unreal Tournament I would simply attach to socket on back → hide actor → disable collision → then equip the other weapon …set current weapon → attach to hand socket → unhide → enable collision