Better way to do this instead of just casting to all objects to see wich one is the right one?

So when I drop an object out of my inventory I want to set the usage ammount to the new spawned object. but since I am going to have a lot of objects I want to do it a better and efficient way. Now I am just checking what object it is and then setting the values.
My object that I spawn is made from a parent base blueprint.

I hope it makes sense what I am trying to do if not then please feel free to ask.

Thank you

Have the actors that you cast to implement an vlueprint interface that takes in the two ints as input parameters to its function and then just call the interface function in place of the casts. If the actor iplements the interface then it is called, if not it’s ignored.

Holy ■■■■ I am stupid. I totally forgot about blueprint interfaces. Thank you

No problem ;).

Have a great day coding. Hope you make lots of progress now that you’ve got a plan to move forward.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.