I need to add component to an actor from another component but unfortunately, Blueprint Graph does not allow me to do so, wich is very odd.
For example, I have a component, that I can add to any actor. But fuctionality of it needs couple of StaticMesh components inside of this actor. So… In order to make my component work, I have to add couple of staticmeshe components to this actor. But what if I need unkown number of those components inside actor?
I thought, that Add Component is Actor’s function, so why can’t I call it from component’s Graph?
You can’t add Static Mesh Components to an Actor Component Blueprint currently. What you’re doing in your second image is adding a Static Mesh Component to Owner of Actor Component, which is Actor Blueprint. If you need to add Static Mesh Components, you’ll need to do it in Actor Component directly.
Ah, I see what you mean. Yea, I would have expected this to work, at least if you explicitly cast to owning BP, but it does not. I’ve entered a bug report for this (UE-24550), and I’ll post here if I see any updates.
I heard back from developers, and this isn’t something they’re going to focus on in immediate future. My suggestion for now would be to use a custom event or function in parent BP that adds static mesh component, and call that from Actor Component BP.
Hello. I’ve already found a way. On Begin Play inside component, I spawn Actor BP, that creates all of those components I need. This actorBP is like component manager, that adds components to owner.
Your suggestion is not okay in my case, coz sometimes I need to add my component to simple StaticMesh Actors on a scene. So there is no way to add any custom events inside those.
That’s a really convenient solution AlFlakky, you should post it as an answer for more visibility! I almost missed it myself.
Unfortunately this hurts potential for modular scene components, which are crucial for design efficiency. There’s no reason you shouldn’t be able to add a component from any blueprint as long as target is an actor.