Let’s say I declare a camera component in my C++ code. How do I get it to show up in the components tab in the BP editor? I tried declaring it as such:
but it only shows up in the Defaults tab and I can’t move it around. I’m pretty confused about TSubobjectPtr so maybe that’s the issue. I tried making the UPROPERTY be just EditAnywhere but apparently I get a compile error when I use it with a TSubobjectPtr.
I just tried it, doesn’t work. Getting really frustrated with the engine. I did a test where I made a brand new blueprint, and with the new one, it DID work and I DO see my stuff showing up in the components list. But that’s not terribly useful…will I have to re-create my blueprint every single time I add a new variable to the C++ code? Why don’t the changes in the C++ code show up in the blueprint I already made that derives from that class? Why do I have to make a new one to see anything happen?
I have experienced many similar problems with C++ components not being added or removed from editor blueprints. Not only that, but I have seen some posts on here from others with the same issue. Hopefully it can get tracked and resolved soon as it seems to be happening to a lot of people… and it really slows development… and it’s very irritating.
After declering subobject in header file you do this in constructor of class:
PlayerCameraComponent = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("Camera"));
//set up settings, you need to set one or else you will get error
PlayerCameraComponent->SetRelativeLocation(FVector(100, 0, 0);
////
RootComponent = PlayerCameraComponent;
Now this will make component a root component, if you already have root component you need to use this insted of last line:
As AnXgotta already mentioned, it seems to be a bug and some people have it.
Workaround: Try recreating your blueprint which inherits from your class and everything should be fine
As of 4.19.2 this is still an issue. I created my BP when the UPROPERTY settings were wrong. Then I closed the editor, fixed the UPROPERTY settings and recompiled. But unfortunately the BP’s already created were still broken. However, any new BP’s I create work properly in the editor. So there must be some issue where the BP does not refresh on its own.