# PostEditChangeProperty in SceneComponent works wrong in editor

**URL:** <https://forums.unrealengine.com/t/posteditchangeproperty-in-scenecomponent-works-wrong-in-editor/466975>\
**Category:** Pipeline & Plugins\
**Tags:** scene-component, unreal-engine, editor, CPP, question\
**Created:** [June 19, 2020, 2:43pm UTC](https://forums.unrealengine.com/t/posteditchangeproperty-in-scenecomponent-works-wrong-in-editor/466975 "2020-06-19T14:43:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SAU-87](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SAU-87](https://forums.unrealengine.com/u/SAU-87)\
**Post date:** [June 19, 2020, 2:43pm UTC](https://forums.unrealengine.com/t/posteditchangeproperty-in-scenecomponent-works-wrong-in-editor/466975/1 "2020-06-19T14:43:47Z")

</div>

Hello. I am trying to use “PostEditChangeProperty” in “SceneComponent”. It works fine if i change property in Blueprint’s Detail panel (cube rotate), but when i change property in Editor’s Details panel nothing happens (cube don’t rotate). As I understand it, this is because after “PostEditChangeProperty” is called the constructor is called also. How to fix it?

```
UMySceneComponent::UMySceneComponent()
{
	UE_LOG(LogTemp, Warning, TEXT("UMySceneComponent"));
	PrimaryComponentTick.bCanEverTick = true;
	SMC = CreateDefaultSubobject<UStaticMeshComponent>("StaticMeshComponent");
	SMC->AttachToComponent(this, FAttachmentTransformRules::KeepRelativeTransform);
	static ConstructorHelpers::FObjectFinder <UStaticMesh> StaticMesh(TEXT("StaticMesh'/Engine/BasicShapes/Cube.Cube'"));
	if (StaticMesh.Object) SMC->SetStaticMesh(StaticMesh.Object);
}
void UMySceneComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) {
	UE_LOG(LogTemp, Warning, TEXT("PostEditChangeProperty"));
	if (PropertyChangedEvent.GetPropertyName() == GET_MEMBER_NAME_CHECKED(UMySceneComponent, Angle)){
		SMC->SetRelativeRotation(FRotator(Angle, 0.0, 0.0));
	}
	Super::PostEditChangeProperty(PropertyChangedEvent);
}

```

 ![304893-fig1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/f/e/7fede658ead9ffc2e0ce01610a28395c739d11cc.jpeg)

 ![304894-fig2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/6/c/e6c138d902af191ca0f8b39cbb623dc57d33def8.jpeg)

---

<div class="post-metadata">

**Author:** ![FunAndFriendly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FunAndFriendly](https://forums.unrealengine.com/u/FunAndFriendly)\
**Post date:** [August 5, 2020, 2:43pm UTC](https://forums.unrealengine.com/t/posteditchangeproperty-in-scenecomponent-works-wrong-in-editor/466975/2 "2020-08-05T14:43:15Z")

</div>

Hey, did you ever find a solution to this? I’m running into a similar problem: [https://answers.unrealengine.com/questions/975425/uscenecomponent-showing-blueprint-archetype-values.html](https://answers.unrealengine.com/questions/975425/uscenecomponent-showing-blueprint-archetype-values.html)

---

<div class="post-metadata">

**Author:** ![FunAndFriendly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FunAndFriendly](https://forums.unrealengine.com/u/FunAndFriendly)\
**Post date:** [August 5, 2020, 10:20pm UTC](https://forums.unrealengine.com/t/posteditchangeproperty-in-scenecomponent-works-wrong-in-editor/466975/3 "2020-08-05T22:20:51Z")

</div>

See my comment on the question above. I found a solution for this and thought I’d share here for searchers.

I created a USceneComponent, with 2 child USphereComponents, and 2 UPROPERTYs for the radius of each sphere.

The challenge was to set the radius of each sphere from the properties, so the editor updated nice and pretty.

**PostEditChangeProperty was a dead end solution for this challenge.** The values kept reverting to the default BP values - because the object is re-created after this function is called. You can’t get there from PostEditChangeProperty.

Another option was InitializeComponent(), but I got Activate() to work first.

```
URealityInteractionComponent::URealityInteractionComponent()
{
	UE_LOG(LogTemp, Warning, TEXT("URealityInteractionComponent()"));
	PrimaryComponentTick.bCanEverTick = false;

	PreviewSphere = CreateDefaultSubobject<USphereComponent>(TEXT("PreviewSphere"));
	PreviewSphere->SetupAttachment(this);
	PreviewSphere->SetSphereRadius(PreviewRadius);

	InteractionSphere = CreateDefaultSubobject<USphereComponent>(TEXT("InteractionSphere"));
	InteractionSphere->SetupAttachment(this);
	InteractionSphere->SetSphereRadius(InteractionRadius);

	SetAutoActivate(true);
}

void URealityInteractionComponent::Activate(bool bReset)
{
	UE_LOG(LogTemp, Error, TEXT("Activate"));
	Super::Activate(bReset);
	InteractionSphere->SetSphereRadius(InteractionRadius);
	PreviewSphere->SetSphereRadius(PreviewRadius);
}
```

---

<div class="post-metadata">

**Author:** ![SAU-87](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SAU-87](https://forums.unrealengine.com/u/SAU-87)\
**Post date:** [August 19, 2020, 5:58am UTC](https://forums.unrealengine.com/t/posteditchangeproperty-in-scenecomponent-works-wrong-in-editor/466975/4 "2020-08-19T05:58:43Z")

</div>

Thanks a lot.
