So basically in an FPS i’m making I have setup a System in Blueprint using the Blueprint Script Components for adding the weapon code to a Player. The Weapon Components are all children components of a main Weapon which contains mandatory code across all guns (How the Mesh is sent to the Player). The children components are then the different types of Weapon which contain the Code for that weapon. E.G the Assault Rifle uses a repeated line trace. However, I have run into a problem with this and I can’t seem to find a fix. The Assault Rifle class has suddenly without reason broken and throws and error (Shown in the picture below) and although it does throw the error the code is still being called properly as the sound effect at the end of the code is always going off and the ammo amount is draining but the Line Trace node is being completely ignored for some reason so I think there might be an issue with the custom event “Push Server”. Another thing is that whenever I edit one of the components I have to go into the player to re-add the component node or I get a compile issue and the blueprint doesn’t save due to /Engine/Transient or something. Please help me find a workaround or temporary fix for this!
Just for the record the errors don’t appear if I’m not using the “Push Server” custom event or Line Trace by Channel but they do appear if one or the other is being called
You truly are a saint! The problem was that the initial set of the player was failing the cast (Maybe because of it creating the weapon before it was able to find reference to the player). To solve this I setup a system to get if it was valid (like you said) and then if it isn’t then it resets the player reference. Thank you so much for the help!
I do however think I might have found another bug. It seems the part of the code next to event begin play is broken and the cast doesn’t actually fail (As I have tried to check this with a print string) But it seems the player reference is always invalid when set through the begin play.
Fixed that part of the code by calling function of that Validate Player system after begin play instead of the casting which for some reason worked? Guess there is a bug to do with that.