Reference Blueprint Root component from code

I spawned a blueprint from C++ which is nothing more than a static mesh with a material.

I spawned the blueprint as an AActor as MYCustomClass does not exist yet in c++.

This works fine. Now I wish to access the components that are listed int he component list that was created in the blueprint inside the editor.
How to do this? I can’t cast the AActor to my custom class as it doesn’t exist it c++.

Solved this.

It’s customary if you post a thread asking a question, but end up solving it yourself to post the solution. That way when people are searching for the same thing they can use your answer instead of double posting.

Sorry but I asked the question in the answers hub I assumed people would look there anyway.

If you have the Actor pointer you can call the templated GetComponents function on it and get a list of all the components and then look in the returned array for the component name or type you are looking for.

What if I don’t have an actor pointer? What if I created my BP as a template from UClass?