I am trying to implement the ability to use held items. I don’t know whats the best practice to do this. and what class to use for the items.
When i use actors for the items i have the problem that every item in the inventory also has a world transform which makes them bound to the level i guess. Also i do not need a visual representation because thats what the itemdrop bp is for.
When i use the Object class with functions i have the problem that i cannot use functions like line trace inside the items …
I tried using actor components for the items but that does really not seem right for the inventory system. Since my inventory is an actor component on the player i would have to add the itemcomponents to the player instead of the inventory (because its no actor)
So the last thing i know are structs which would fit nice since most stuff ist just item data. But how do i map a function for example from a blueprint function library to a struct? Using Strings for the function names seems like bad practice.
Can anyone lead me to the right path?
edit:
i saw a version where u spawn an itemeffect actor that does what u want on use but in my game i will use the item repeatedly very fast so i am not sure if spawning multiple actors per second is a good idea