Can you Add a Data Asset to a Static Mesh??

Wondering if it is possible to add a Data Asset to a Static Mesh. I have some gun attachments that are working fine as a static mesh and don’t require code. I made Data assets for them to reference certain perks/drawbacks each attachment has on the weapon (1.5 zoom, handing etc)

I know I could make them all blueprints and add the data asset with a variable normally, I’m just curious if it is possible. i see User data in the static mesh. But I’m not sure how to reference that data after

Do you mean an actor? Because that is not needed; instead, one would extend the static mesh component.

Yeah i could make them an actor,

But currently ive added them as a static mesh into my gun class (scope, barrel, grip etc) and exposed them on spawn so I can set them when they spawn into the world

Im wondering if the static mesh itself can have a data asset to reference later or will it have to be made into an BP actor?

So about how many elements / properties are we talking about? If its say 5-10, then you could just use the basic static-mesh TAGS system and parse that info out. Whereas, if its more like 20 / 50 / 100 or more, that’d probably be too much of hack to use in production. :wink:

Hey @TakenGrace!

Yeah, a static mesh can’t hold things as variables like that. You’ll have to add it to an actor.

Hope that helps!

Thats what I figured.

Thanks

To clarify: a Static Mesh Component can - extend it. It will become a component that has a static mesh, script, functions, variables, can be attached to actors and so on.

This would still require that the static mesh component be attached to an actor, correct?
It simply adds reusability and faster scaling of a project depending on use-case?

I suppose I was only thinking of a static mesh dropped into a scene/level. Good looking out!

Very, OP wanted gun attachments, it should work pretty well.

1 Like

I forgot that detail as we moved forward

@TakenGrace @Everynone Is right, and that’s probably a good move- that way the components you attach have visual representation without extra steps, as well: Static Mesh Components that you can add to/remove from your gun actor that could have extra variables such as your data asset.

But also- extending a base class like that could be fidgety by my research so you may want to go the route of actors you can attach to points (using attach actor to component) which will then parent it to the actor. You could go either way, personally I have more experience attaching actors so I would go that route, but the static mesh component extended is definitely an option.

Yeah ill switch it to actors I got it to work with just the static meshes but I need the data asset to get changes to variables on the weapon based on the attachment

Thats for the brain storm :+1:

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