Store Variable inside Static mesh?

I have an actor that contains multiple static meshes. Each SM is unique, and needs to have its properties set manually. When the cursor/player interacts with a static mesh, the actor needs to some how get a variable associated with the static mesh.

What is an efficient way to achieve this? I thought of creating an actor for each static mesh and storing the variable that way, but my impression as a novice is that that method is inefficient.

Any suggestions/advice would be welcome

It depends on what you need to do, but what works in most cases is a map.
Have the key be a static mesh component with the value being whatever data you want. Alternatively you can make the value a custom struct if you need more than one type of data.

Here’s a quick video that explains maps:

1 Like

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