Currently in my project I have the need to add a UStaticMeshComponent blueprint to an APawn during gameplay via C++.
For context: As the player moves their mouse across an APawn in the form of a rock, I’d like moss UStaticMeshComponents to spawn on the rock, execute their BeginPlays and remain on the rock as it rolls away.
I haven’t had much success adding components outside of the constructor before so any advice here would be appreciated. In particular, I’ve found it difficult to uncover anything about adding blueprint components via C++. Is it even possible?
bpInstancedMossMesh is the name of the blueprint I’m trying to add to my actor as a component. It inherits from a custom C++ class that inherits from UInstancedStaticMesh. I’m concerned that the compiler won’t know that bpInstancedMossMesh exists. Is there anything specific I have to do to inform it of the blueprint’s existence?
I’ve tried creating the following UProperty in the header file, setting it to the desired static mesh blueprint in the editor, and trying to have it appear during runtime but with no luck. Can anyone see what I’m missing?