Working on creating a interaction blueprint component to add to pawns that have the ability to interact with thing.
I want it so a developer setting it up can choose whether, when the pawn tries to interact (i.e. player hits interact button), if the trace originates from the actor’s location, a component (of the developer’s choosing) within the actor, or a socket attached to a component. Obviously, if the developer chooses the actor as an origin, there shouldn’t be a need for him/her to select a component. Now the issue I’m having is that I want to keep the spaghetti to a minimum but it seems the only way I can avoid “Accessed None” errors when not specifying a origin component for the trace is to use an “impure” IsValid node.
My setup at the moment involves using an enum that controls what trace origin the blueprint will use. I tried to hook this up to a select node to get either an actor based location (which shouldn’t even bother checking the component) and the component based locations, but it for some reason seems to evaluate/parse all options before selecting the one specified in the enum. In other words, even if I select actor based location, it still delivers “Accessed None” errors.
So the question is: do I have any options at all to do this in a “pure” way, or is it simply not possible without resorting to an impure IsValid node (or spaghetti-hell through event dispatchers)?
For reference, I’ve attached some quick pictures of my current setup. Keep in mind these are still in the early stages so please forgive the unoptimized parts and a tiny bit of node spaghetti as I’ve latched things on for testing purposes. For the record, the “Get Trace End” function is set up in almost the same way as the “Get Trace Origin” so I didn’t bother including it as the error clearly triggers in both functions.