Why is the 'Add StaticMeshComponent' function missing for an Actor spawned in BP

As far as I know:
The UObject does not have the framework for adding and containing components. This is something that resides in the AActor class.

In the same manner I don’t think any component can contain another sub-component. At least I couldn’t get it to work last time I tried, but I could be mistaken and just haven’t seen the full picture yet.

In a BP with a base class of Actor, if I use the “Spawn Actor from Class” node and set the class to Actor and then drag off the Return Value pin, the “Add StaticMeshComponent” node is available for the spawned Actor. However if I repeat the steps in a BP with a base class of Object (or ActorComponent), the “Add StaticMeshComponent” node is not available for the spawned Actor. Why is that?

Edit: to clarify, I’m trying to add the StaticMeshComponent to the Actor which was just spawned by the blueprint, not to the blueprint itself. Therefore I assumed that the base class of the blueprint shouldn’t matter.

The thing is that I’m trying to add the StaticMeshComponent to the Actor which was just spawned by the blueprint, not to the blueprint itself. Therefore I assumed that the base class of the blueprint shouldn’t matter.

The reason you can’t is because the Add StaticMeshComponent function is protected. Meaning it can only be accessed from AActor or classes that inherit from it. UObject and UActorComponent do not.

What you need to do: is create a Function on the Actor itself that does everything you wan’t to do it. Then when you spawn it, drag the reference and just call the function. It will work because Functions / Custom Events are public by default. Meaning they can be accessed anywhere.

In the end is the same thing you wanted to do, but “correctly”.

Okay, thanks. Is there an easy way to see whether a function is public or protected when working with blueprints? For example in Visual Studio intellisense the icon for a member indicates any modifiers. I can’t even find the documentation for AddStaticMeshComponent…

Guess the give away is that it doesn’t show (?)

Other than that i don’t think there is. You would have to look in C++ to check for sure.