Need help figuring out why my interface funtion isnt triggering

Hello, im very new too ue5, and have been trying to create an inventory system for quite some time by now, im having a problem where my interface function isnt triggering using a linetrace

so this code working and triggering the function but id like to switch it too a linetrace for more control

however this code where i tried replacing it with a linetrace causes the function not to trigger at all


the linetrace is hitting the collision and getting the object refrence

the code within the function should work fine and the rest of the system however i cant figure out why the function isnt triggering with a linetrace hit actor instead of a other actor

is it because the other actor works very diffrent to hit actor? i couldnt find much about this but if it is is there a way i can achive the same results with a linetrace?
im sorry if its a very simple answer (probably is) but i cant seem to find any answers online and i know there are probably way better ways to do it, thank you for any help (please im desperate)

Try calling the line trace on the IA interact node

Hey, thanks for the suggestion, however this still does not work, the function isnt being triggered at all

Couple things to maybe check them, is the inventory items collision channel/responses correct? Also is the IA set into the defaults of the players class? Also in the add items to inventory function, typically I would think the target input would be a reference to the inventory component itself no? And you’d want to setup an input for the inventory items? That’s how mine works at least

my linetrace should be working correctly as it is detecting the actor and printing out the value of it

the interaction is triggering and is set into the defaults of the player class if that is what you mean

im trying to create a very simple inventory system as i dont need an advanced one so i dont have a inventory component im trying to run the inventory system within the player character blueprint, and the whole system works as long as the function gets called but well yeah thats my problem, do i need to add a inventory component to be able to call it with a linetrace? (tried that too at some point but its possible i did it wrong) I should note this logic is currently happening within the item blueprint and im not sure if that could be causing the problems, i have a print string setup in the function and the code until my add to inventory function is running however after that it just doesnt do anything

It’s hard to say without knowing how your inventory /inventory items functionality is setup, that looks like a lot of line traces though and it’s hard to tell where they’re coming from, based off your blueprint, is it possible one of the failed hits is setting the hit actor reference to 0 before it reaches the add to inventory function? If you want to hop in a discord I’m sure I could help you work this out : roflmaster.(With the period)

Can you add an “Is Valid?” node (with the question mark) before you set the hit actor result of the line trace to your object type variable?

I thought so too, but he also said it doesn’t even get triggered which is weird

i tried adding in a delay at the end and also just removing the set and making it go straight into the target node, but there is still nothing happening, also i appriciate your offer and i might have to get help like that if its not possible to figure it out, im assuming its some tiny dumb mistake that i dont know is a mistake yet

i tried adding a is valid node, but still theres nothing happening

(im assuming like this?)


the message goes too the inventory interface function in the character blueprint but the print string never goes off nor does the function itself

could it be since the linetrace is setup in the item blueprint and not the character blueprint? im just very lost to what could be causing the issue, but this function doesnt go off, i also tried making an enttierly new project with the same setup and the function still only works with the other actor and not the hit actor so id assume its something there with the linetrace or the variable, thanks for trying to help

You gotta drag that hit actor into the input object pin of the “is valid?” node. As I said earlier, since you mentioned that the rest of the code doesn’t even get triggered, there needs to be another issue behind it but I wanned to know the result of this properly applied “is valid?” node as well

okay i did that and the variable is still being set but again no diffrence in the function working or not

Are you casting necessary variables from that blueprint properly?

Why am I even asking, you already pulled out those variables right :rofl: I’ll get back on my PC some time today, I can still try to help like this but it will be a lil hard :smiling_face_with_tear: can you clarify if the only thing you’ve ever changed from that working collision box method to line trace is just… adding line trace?

im not using casting, which is why i made the linetrace within the linetrace within the item blueprint, so its entierly possible that this could be the issue, where would i use the cast?
is it possible the problem is a lack of a connection towards the player character bp?

ah okay yeah the only thing i changed was adding the linetrace, everything else is the same, in hindsight maybe trying to make a inventory system shouldnt have been the first thing i did after trying to learn coding lmao, but yeah any help is very much appriciated at this point

But I think you made the player detect collision and then access the item, right? But in this new approach of yours, you said you perform the line trace in a different blueprint than the character blueprint. Is that right?

yes that is correct, the collision was also detected in the same bp as the linetrace (the item blueprint) , which should then send a message to the function add to inventory which is connected to the player blueprint but as we know the message isnt being sent

could this be the issue, would it be better to have the linetrace logic work within the character blueprint and then use a cast towards my item blueprint in some sort of way?

I mean if both methods handled the data handling the same way, it shouldn’t be. I’ll think about this and get back to you!

okay thank you!

Hey, I managed to make some more time to review your screenshots once again and you did already provide helpful explanations, it shouldn’t have been this complicated given that it’s such a simple task like you said. But I think my mind is such a mess rn, also I can’t really debug much since I’m away from my PC, so I’ll just ask you to do the following and advance from there if it does work:

Perform a line trace however you want, either start from the player or from the sky, it really doesn’t matter. It can even hit things it’s not supposed to but you can easily prevent that by using that “Is Valid?” node I mentioned earlier, and if it still hits other objects that you don’t want to take into account, you can add actor tags to the objects you want to store and check if the tags match using the “Actor Has Tag” node. Just don’t have it do it’s thing constantly like it is currently, plugged into that event tick, just cast it on input.

If you want that code to be included in another blueprint other than the player, use a “Cast To” node inside the character blueprint and pull those out from there. What you should plug in that object pin of that node changes depending on what you’re casting from. Note that there are certain blueprints that you can’t cast from.

You can then manage the array or struct or whatever you wanna use wherever you want. You can create them inside the blueprint you’re performing the line trace and pull out those later, or just create them inside the character blueprint if they’re gonna be used for the player’s inventory anyway.

I hope I understood your objective right, also my suggestions were kinda obvious and may not be what you’re looking for so maybe this is not a good answer at all, but these are all I can say for now since I must be away from my phone for a while. Just wanned to give some answer before I left. Though if this works, hopefully you can move on from here :heart: