I haven’t touched UE for about three weeks so this question may be a little vague!
I have a master blueprint class for my guns called MasterGunBP. It contains a static mesh and some logic common to all weapons, including structs to help each weapon customise various things like player animations and damage amounts.
Some of the logic in MasterGunBP wants to reference a static mesh, particle emitter, etc, so there is a static mesh present inside the master blueprint.
When I inherit a child blueprint from MasterGunBP, I can override the struct values but not the static mesh. I’m unable to change my gun model.
How should I be approaching this? Is there a way to reference a hypothetical child blueprint mesh that should always be present?
I was thinking about making the child blueprint load in its own model defined using the child struct on game start. is this a reasonable solution?
This is one aspect of blueprint (considering inheritance mesh is an import part of game), that can be either better clarify or improve. I had spend serious amount of time to get a neat solution. I have now a solution, but its flawed. Hopefully someone have a better solution, but here we go.
You can look at the blueprint content example, under the blueprint level (forgot which one). Check out the one about picking up blue health, & there is a cupcake as a child BP. Consider its a solution by Epic, its still flawed, but more of the flaws later.
First in the parent class, create a variable to a staticmeshActor (or maybe its static component, you should check the example). Lets call it MeshToUSe
In the Construction script, call a function call SetStaticmesh(I hope its the right one, as I am recalling from memory).
See here for the function node.
Set the original mesh as target, & meshToUse as the new mesh. In the child class, you will be able to replace the mesh (should be under default section, in the default tab of the blueprint) for every unique instances.
Now for the flaws.
It always show the parent default staticmesh in the content browser, so the thumbnail picture is useless. It will however show the proper mesh in the level & Blueprint editor.
You cannot perform any transformation of the new mesh in the blueprint component editor, you can probably set vector variables (& define in constuction script) to hard code (typing in) translation scale or rotation.
Physic doesn’t work (but it could be that I haven’t been able to figure out) at least using the content browser blueprint setup, everything else work though.
have you look at the mixamo character set ? This a parent mesh empty which is filled in child. Do the same (in your parent remove the mesh from the mesh component in details. Then you’ll can set it in children. Have a look at them and you’ll see how do it for your weapons.