# How do I use PostEditChangeProperty?

**URL:** <https://forums.unrealengine.com/t/how-do-i-use-posteditchangeproperty/324110>\
**Category:** C++\
**Tags:** property, unreal-engine, question, CPP\
**Created:** [July 5, 2015, 12:22am UTC](https://forums.unrealengine.com/t/how-do-i-use-posteditchangeproperty/324110 "2015-07-05T00:22:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_8b77cbb9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8b77cbb9](https://forums.unrealengine.com/u/anonymous_user_8b77cbb9)\
**Post date:** [July 5, 2015, 12:22am UTC](https://forums.unrealengine.com/t/how-do-i-use-posteditchangeproperty/324110/1 "2015-07-05T00:22:36Z")

</div>

Say I have a boolean UPROPERTY called MyBool. I want it so that when this is ticked true in the editor (details panel of my custom actor), a function will run to set some misc members of that actor.

PostEditChangeProperty() seems to be what I want, but I don’t get how to grab the value of the actual boolean. Here’s what I have so far:

```
void ASomeActor::PostEditChangeProperty(struct FPropertyChangedEvent& e)
{
	FName PropertyName = (e.Property != NULL) ? e.Property->GetFName() : NAME_None;
	if (PropertyName == GET_MEMBER_NAME_CHECKED(AInteractable, MyBool)) {
		UBoolProperty* prop = ???
		if (prop) doThings();
		else undoThings();
	}
	Super::PostEditChangeProperty(e);
}

```

---

<div class="post-metadata">

**Author:** ![kishoreven](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kishoreven](https://forums.unrealengine.com/u/kishoreven)\
**Post date:** [July 5, 2015, 12:19pm UTC](https://forums.unrealengine.com/t/how-do-i-use-posteditchangeproperty/324110/2 "2015-07-05T12:19:32Z")

</div>

/\* If MyBool belongs to the ASomeActor \*/  
void ASomeActor::PostEditChangeProperty(struct FPropertyChangedEvent& e)  
{  
Super::PostEditChangeProperty(e);

```
     FName PropertyName = (e.Property != NULL) ? e.Property->GetFName() : NAME_None;
     if (PropertyName == GET_MEMBER_NAME_CHECKED(ASomeActor, MyBool)) {
             /* Because you are inside the class, you should see the value already changed */
                if (MyBool) doThings(); // This is how you access MyBool.
                 else undoThings();

            /* if you want to use bool property */
            UBoolProperty* prop = static_cast<UBoolProperty*>(e.Property);
           if (prop->GetPropertyValue())
               dothings()
          else
                 undothings()
     }
 }
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8b77cbb9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8b77cbb9](https://forums.unrealengine.com/u/anonymous_user_8b77cbb9)\
**Post date:** [July 5, 2015, 6:34pm UTC](https://forums.unrealengine.com/t/how-do-i-use-posteditchangeproperty/324110/3 "2015-07-05T18:34:36Z")

</div>

Perfect, I should’ve realized that `POSTEditProperty` implied that it had already changed… Thanks!

---

<div class="post-metadata">

**Author:** ![Kafumanto](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kafumanto/32/1194651_2.png) [@Kafumanto](https://forums.unrealengine.com/u/Kafumanto)\
**Post date:** [November 25, 2015, 2:08pm UTC](https://forums.unrealengine.com/t/how-do-i-use-posteditchangeproperty/324110/4 "2015-11-25T14:08:48Z")

</div>

Only to complete the great answer by @kishoreven, you can wrap the whole method inside `WITH_EDITOR` preprocessor definition:

```
#if WITH_EDITOR
void ASomeActor::PostEditChangeProperty(struct FPropertyChangedEvent& e)
{
    // ...
}
#endif
```

---

<div class="post-metadata">

**Author:** ![darkgaze](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkgaze](https://forums.unrealengine.com/u/darkgaze)\
**Post date:** [January 22, 2018, 3:51pm UTC](https://forums.unrealengine.com/t/how-do-i-use-posteditchangeproperty/324110/5 "2018-01-22T15:51:56Z")

</div>

What if the property is located inside the code of a custom component on that actor, instead?

---

<div class="post-metadata">

**Author:** ![KEATE\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KEATE\_1](https://forums.unrealengine.com/u/KEATE_1)\
**Post date:** [June 15, 2020, 8:37am UTC](https://forums.unrealengine.com/t/how-do-i-use-posteditchangeproperty/324110/6 "2020-06-15T08:37:03Z")

</div>

If your component inherited from ActorComponent or SceneComponent, just override this in your Component Script.

---

<div class="post-metadata">

**Author:** ![ViaCognita](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/viacognita/32/906601_2.png) [@ViaCognita](https://forums.unrealengine.com/u/ViaCognita)\
**Post date:** [August 11, 2021, 3:10pm UTC](https://forums.unrealengine.com/t/how-do-i-use-posteditchangeproperty/324110/7 "2021-08-11T15:10:19Z")

</div>

You can find how I have used `PostEditChangeProperty` in my tutorial: [Atari Pong Clone](https://medium.com/p/b14707bca3a5)
