Problem with inherited custom class

Hey y’all, pretty new to UE4 and ran into a bit of roadblock with a blueprint inherited from a custom C++ class of mine. I’m building a hover car of sorts and I built a custom class for the kart. Here is the relevant part of the header for that class:

img1.png

As you can see, I’m trying to add some components to the kart that can then be edited within the blueprint editor when I create a blueprint class derived from this class. This itself is working fine and this hierarchy is created within the blueprint editor:

img2.png

The main problem I’m having is that I want to be able to move the “hover1” component around relative to the kartBody Static Mesh. However, the details panel for the “hover1” component doesn’t have options to change the relative location (or rotation for that matter). This is what it looks like:

img3.png

Some other potentially relevant information: UKartHoverComponent is a custom C++ class I made that is a subclass of USceneComponent (it is currently completely empty except for the pre-generated stuff from unreal). I instantiate hover1 in the constructor for AHoverKart using this line:


hover1 = CreateDefaultSubobject<UKartHoverComponent>("hover1");

I’ve tried using “EditAnywhere” instead of “VisibleAnywhere” in the UPROPERTY macro but it doesn’t fix this.

When I add a SceneComponent within the blueprint editor, it has all of the transform options, so I’m confused as to why this component is missing some of its inherited variables. Thanks!

Hmm…

Is the parent class of UKartHoverComponent something that can have its location and rotation modified?

Has the UKartHoverComponent somehow hidden those variables?

Thanks for the response!

Hm, well the parent class of UKartHoverComponent is USceneComponent which I’m pretty sure has location and rotation. When I add a SceneComponent manually through the blueprint editor I’m able to modify location and rotation.

The thing about this is that I haven’t touched UKartHoverComponent at all, I just let UE4 auto-generate a class that derives from USceneComponent, so to me it seems like this should behave in the exact same way as a SceneComponent.

Additionally, a weird thing I discovered while messing with this some more:
If I add a UKartHoverComponent to the hierarchy through the blueprint editor instead of programmatically in the base class, the component allows me to modify location and rotation… which means that this has something to do with the fact that the blueprint class is inheriting this component from its base class.

Edit:
Also tried programmatically adding a SceneComponent to this base class and the exact same thing happens in the blueprint editor, so this has nothing to do with it being a custom component.

Edit 2:
Even weirder: I am able to move the component by clicking and dragging on the translate tool in the viewport in the blueprint editor and it successfully moves the component… but the details panel still doesn’t have location listed :confused:

I fear we’re both missing something here :frowning:

Anyone else got a suggestion?

We need to see the class declaration for UKartHoverComponent.

Here is the header file for UKartHoverComponent:

Hmm, no clues there.

Are you calling functions
hover1->SetupAttachment(RootComponent);
hover1->RegisterComponent();
??

This fixed it! I guess I just assumed that the component was properly “attached” since the hierarchy seemed to build itself but it seems that calling those two functions exposed its full transform to the blueprint editor. Thanks so much for the help :slight_smile: