I’m using components now for some things and I love it
I’ve come across two problems though.
first one. I have an Equipment Component in my Character Blueprint. the component was added via C++ and I have some properties in it. basically I’m doing this:
yet I can’t edit it “anywhere”. it does not show up at all in my Character Blueprint. yet if I drag and drop the character BP into a scene I can edit the component and the property shows up.
I seem to recall this working previously (4.7 preview something), but now it’s just not showing up at all (4.7.2)
second one. I’m trying to get the owner of the component but it returns null. this is what I’m doing in a function of my component’s code:
ACharacter* pawnOwner = Cast<ACharacter>(GetOwner());
if (pawnOwner != NULL)
{
// more code
}
when I debug it pawnOwner is always null. is the owner of the component not really the actor that contains said component?
To make the variable show up inside the blueprint editor you’ll want to add “BlueprintReadOnly” or “BlueprintReadWrite” to the UPROPERTY macro. BlueprintReadOnly will give you a Get node inside the blueprint whereas using BlueprintReadWrite will allow you to both Get and Set the variable in the blueprint.
this is not about the blueprint editor, this is only about the default properties of the variables. my variables are marked as EditAnywhere, and yet I cannot edit the default properties of them
picture for clarification and obvious “aaaah” moment:
Did you change the type of component in code at all (such as from a scene component to a static mesh component or something else)? Are you seeing the same issue in the current 4.9.2 engine version? If so, could you post the code that you use to setup the component that isn’t displaying the details panel?
as of 4.9.2 I can now see the default variables in my Blueprint, and editing them also reflects them into instances properly, so the issue is resolved.
they however, display inside an inline object which feels very strange. and it doesn’t behave like that in the Details panel of a placed actor