How to add blueprint component to APawn during play.
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?
asked Jan 07 '18 at 07:25 PM in C++ Programming
If you need further help besides that show me what you got so far. (pastebin.com)
answered Jan 08 '18 at 12:59 AM
Hey there, like Nachtmahr mentioned you need to use NewObject, here is an example:
answered Jan 08 '18 at 12:18 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here