Two problems with Components

hi there,

I’m using components now for some things and I love it :slight_smile:

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:

UPROPERTY(EditAnywhere, Category = "Equipment Component")
		FName MainWeaponAttachPoint;

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?

thanks

ok the problem number 2 was just me being an idiot (or working late). i was getting the owner of a component not owned by a character :smiley:

problem number 1 still has no answer though

Hey Chosker-

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.

Cheers

Doug Wilson

hey Doug,

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:

hello Epic,

any info on this?

regards, Chosker

Hey Chosker-

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?

hi,

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

here after I unroll the inline object

is this intended?

Hey Chosker-

This is expected if you’re using the EditAnywhere specifier in the component’s UPROPERTY macro list.

that was it, thank you!