Skeletal mesh reference from struct is not compatible

I’ve created a skeletal mesh variable in a struct (with all the other weapon data) so that when I switch weapons I can dynamically get the mesh and spawn it. But for some reason the two are not compatible. Can anyone tell me why? Also: is it even a good idea to implement this system for switching weapons, or is there a better alternative? In screenshots 2 and 3 I show the entire process. For some reason, I have the same issue with the class variable plugged in from the struct. The variable “equipped weapon” works when I manually select a class from the spawn function, but it doesn’t if I plug in the struct. Why is that?

You have the wrong variable type set up in your struct. You have selected Skeletal Mesh but you need to go for Skeletal Mesh Component for the variables to be compatible.


Your class might not be working because it doesn’t get set after you equip weapon. I edited your screenshot below.

Does this setup spawn a new weapon every time you switch, because I think that’s the case. If you save your weapon reference in a variable you won’t have to spawn it every time, just toggle the visability.

Thank you!

Hi! I’ve had a chance to edit the code and I still have a few issues. The Skeletal Mesh Component is compatible now, but in the Data Table I can’t put any mesh anymore, the box that was once pink and had all the correct meshes to select from is now grey and with nothing in it. As for the Equipped Weapon thing: it’s not plugged in because it’s not compatible with the Class struct I’m using, even though I don’t understand why, since it’s literally the same as manually selecting the Class from the SpawnActor function. Maybe I selected the wrong variable in the struct? What would be the correct one?