I get no error message, but nothing shows up in the world. I also tried to run it without bAutoRegister = true and without RegisterComponent() since I think they are redundant, but it nothing changed.
The variable SphereMesh is set in the Constructor like so:
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereModelOb(TEXT("/Game/Shapes/Shape_Sphere"));
if (SphereModelOb.Succeeded())
{
SphereMesh = SphereModelOb.Object;
}
Thanks for your input, but I’m afraid that this also doesn’t work for me. Just out of curiosity, is your CreateSubComponent() method inside an AActor derived class? Mine is not, do you think it makes a difference?
Yes, it is, but I don’t think that’s relevant, as long as you make the component owned by a particular Actor at some point. I think you might be missing the RegisterComponentWithWorld() call? I remember that being tricky and hard to find.
I think it is relevant. Just try adding a mouse cursor in the player controller of the default top down template. You’ll find that it never shows up, but if you implement the same code in the character it works.