Attach Weapon to Socket not working.


I read several Tutorials about Weapons and how to add the basic funcionality but at some points the tutorials are inaccurate or won’t work.
So i mixed up some tutorials to make my own way to implement weapons but there is currently a big problem.

In the Armes Mesh I added a Socket for my weapon, added a preview mesh and everything looks great.

So I made a simple Function to attach a StaticMeshComponent to the socket.

But ingame, there won’t appear any weapon mesh.

So where is the problem? Is it the Mesh? Because I rotated the socket in the preview to make it fit to the arms.
Thanks for your help!

How or from where do you get the weapon mesh? -> because in the static mesh you have to set the mode to “moveable”. Otherwise it wont work! So for example: when you add the weapon mesh to the component tab you can change the mode and after that you can attach it to the socket.

So you could create a new blueprint with the weapon mesh in it and in there you can change the mode + after that you can spawn it in your other bp

The mesh comes from the content browser. I also tried to use a skeletal mesh but nothing happens. I also tried to your tutorial about attatching stuff to a socket. It also won’t work.
Somtimes - not every test play - i reciev 1 error while playing. Seams like the socket is missing sometimes. This is very strange.

Have you done it exactly the same? (so with the level blueprint) -> when not, then try it out, because then we will see if it is a problem with the socket or your upper setup

I’ ve done it exatcly the same.
This is the Tutorial i was reading and trieing to recreate:

He is just using a static mesh from the content browser. SkeletalMesh also won’t work. I’m not recieving an error with this but the gun isn’t visible.

Do you have any way of checking if the thing even spawned? Your setup isn’t exactly ideal to be honest. It’s not a prime example of oop. But it’s not your fault, since you just followed a tutorial.
You call “SetStaticMesh” on your weapon and then you attach it, but the question is, what is that weapon variable and when do you actually spawn the weapon?

I would rather spawn a new weapon (or unhide a previously spawned one) and then attach it to the socket.

sorry for the late reply. I’m now working with another weapon system. I’m using weapon meshes that includes the arms - like the blue placeholder and just set the ‘1pMesh’ to my new weapon.
Changing some variables for recoil, Ammo and so on and everything is working fine. A lot easier than the tutorial. Maybe not the best solution for everyone but it’s working fine for me.

When I’m ready with my sytem and it’s working perfekt I’m making a short tutorial.

how did you resolve this? I have the same problem

The object needs to exist in-game (an instance of it needs to be in the world somewhere) for that type of setup to work I believe.

Your weapon has “Simulate Physic” checked by default. Uncheck it, and make sure to set physic simulate back to on in Blueprint when want to drop it.