EditAnywhere and BlueprintReadWrite but Cannot Modify USceneComponent's Properties?

I have two properties in my C++ USceneComponent.
I want to be able to change these in the editor, but despite giving these properties the EditAnywhere and BlueprintReadWrite I can’t figure out where and how to change them!

UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class EFFICIENTGRAVITY_API UGravityComponent : public USceneComponent

        // Sets default values for this component's properties
        // Called when the game starts
        virtual void BeginPlay() override;
        // Called every frame
        virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
        UPROPERTY(EditAnywhere, BlueprintReadWrite)
        	float Power = -980.0f;
        UPROPERTY(EditAnywhere, BlueprintReadWrite)
        	USphereComponent* SphereCollision;
        	TArray<AActor*> AffectedActorsArray;
        	void OnSphereOverlapBegin(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
        	void OnSphereOverlapEnd(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);


When I look at the property in the UE4 Editor it says "Native components are editable when declared as a UProperty in C++.
Could someone kindly tell me what I’m missing?

Thank you


This is what I see in the editor for an instance of an actor that has a GravityComponent.

Hi Calembendell,

It sounds like this is a case of not knowing where to look for the property in the editor, right?

The short answer is that by default Unreal will place the property in a section of the details panel named after the component. Based on your code, I’d expect to find the properties in a section called “Gravity Component”. A quick test on my system (using only the first of your properties) showed this:


Note, however, that if you include the component in another actor (e.g. in the default setup for a C++ actor), you may need to add a variable for it and expose that to the editor in order to properly edit the values. (Otherwise, Unreal seems to disallow editing of the values so the actor itself can manage its children.) To do this, you’d add a couple lines to your class definition (in the *.h file):

class ExampleProject_API AExampleActor : public AActor

    // ...

    // The component that handles the gravity changes
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Gravity")
    UGravityComponent *GravityComponent;

You can also specify a custom section for your property with the UPROPERTY() specifier. For example, using this specifier will place the property in the section named “Your Custom Gravity Section”:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Your Custom Gravity Section")
float Power = -980.0f;


For reference, the details panel (where these properties are found) defaults to the far left edge of the Unreal window. You’ll also need to have the component added to an actor (or other object) and selected in the component hierarchy or the details panel will show you details for some other component:


The component hierarchy is in the upper-right corner of the Unreal window by default.

Does this help?

Thanks for the response! I’ve edited my question to include a screenshot of what i see in the editor in the world outliner. I get the same thing as you in the actor editor, but I can’t change the values for instances of the actor. Is that normal? I thought EditAnywhere meant I’d be able to edit the values for instances as well as edit the defaults.

It looks like I made need to make an AActor class in C++ that has a UGravityComponent as an edit anywhere UProperty, but that seems like it shouldn’t be necessary.

Ahh, yes!

That would be exactly the right approach.

I’m not actually certain I’ve discovered the reasoning for this choice, but the behavior you’re seeing is normal. EditAnywhere properties apply to the properties themselves but if the component itself is not editable, you’ll also be unable to edit the properties.

If I had to guess, I’d say it’s probably an encapsulation issue – Using your component hierarchy as an example, if your gravity component contains the collision component and needs it at a particular location/size in order to function properly, you probably wouldn’t want someone in the editor to move it somewhere else. By making the collision component EditAnywhere though, you’re letting the editor know that it’s actually okay to tweak it as needed (and implying that the gravity component will handle that properly). That said, properties of the collision component will still be either editable or not depending on which ones it expects to be changed (or rather their own EditAnywhere/etc. specifiers).

I’m certainly speculating here, but does that make sense?

That makes well enough sense to me. It seems there should be a mechanism by which I can indicate that I want a component to be editable when added to an actor, but that’s an issue for another day! Could you edit your answer to include the solution, and I’ll mark the sucker as correct. :slight_smile:

ah, here’s an interesting thing though. i cannot edit the values of the sphere collision. i can edit them, but when i try to compile the blueprint derived from the actor cpp the values go back to the default values.

I’ve updated my answer to include the information about EditAnywhere components within C++ actors.

I seem to recall seeing this issue somewhere too. I bet it was in one of the versions of the Match3 example project I tried. Despite the tile library being editable everywhere I could find, updating the actor (instance) and the blueprint didn’t seem to make a difference – It would just revert to the original values when I began the game.

I never did figure out why, but since it was an example project I didn’t really need to. If you find out what is happening, I’d love to hear it!

Try to set your UPROPERTY in VisibleAnywhere and Blueprintable instead of EditAnywhere, this specifiers seems to be more adapted for editable C++ created components.

Then, if that component instance contains more UPROPERTIES you want to display and change from the parent class… how do you show those properties? It shows just a link to the object instead of its contents.

I think Unreal handles this extremely poorly, however a workaround that I’ve been using since it was recommended to me by Epic staff is to set the properties as: UPROPERTY(VisibleAnywhere, meta = (AllowPrivateAccess = “true”)). Check if that fixes your issue :slight_smile:

For future viewers, it seems the best way to go about working around this issue is to use the below meta specifiers :-).

UPROPERTY(VisibleAnywhere, meta = (AllowPrivateAccess = "true"))

I just added a detailed answer here if anyone could benefit from this.