# Safely find a reflected property name?

**URL:** <https://forums.unrealengine.com/t/safely-find-a-reflected-property-name/442607>\
**Category:** Rendering\
**Tags:** macro, UProperty, reflection, unreal-engine, question\
**Created:** [February 2, 2019, 6:16pm UTC](https://forums.unrealengine.com/t/safely-find-a-reflected-property-name/442607 "2019-02-02T18:16:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_8c09e5641](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8c09e5641](https://forums.unrealengine.com/u/anonymous_user_8c09e5641)\
**Post date:** [February 2, 2019, 6:16pm UTC](https://forums.unrealengine.com/t/safely-find-a-reflected-property-name/442607/1 "2019-02-02T18:16:47Z")

</div>

Hi all…

I need to access a UPROPERTY of a UCLASS through reflection in C++. It shouldn’t present any challenge in itself, something along the lines of:

```
MyObject->GetClass()->FindPropertyByName(TEXT("MyPropertyName"));

```

However I’m absolutely certain that there’s a preprocessor macro that provides safe way to reference a property name in C++, that will throw a compile time error in the event that the name changes. Something like this:

```
FName PropertyName = MAGIC_PROPERTY_MACRO(MyClass::StaticClass(), TEXT("PropertyName"));
Settings->GetClass()->FindPropertyByName(PropertyName);

```

Can anyone remember what this macro’s called? It’s a bit tricky to find-in-all-files within the source code as I just can’t remember any part of its name! (Tried searching for safe property, things like that - also tried googling for half an hour). Gone through UClass.h to no avail.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8c09e5641](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8c09e5641](https://forums.unrealengine.com/u/anonymous_user_8c09e5641)\
**Post date:** [February 2, 2019, 6:46pm UTC](https://forums.unrealengine.com/t/safely-find-a-reflected-property-name/442607/2 "2019-02-02T18:46:35Z")

</div>

Ah found it… **GET\_MEMBER\_NAME\_STRING\_CHECKED**.

```
UProperty* Property = UStaticMesh::StaticClass()->FindPropertyByName(GET_MEMBER_NAME_STRING_CHECKED(UStaticMesh, SectionInfoMap));

```

For anyone else reading this in the future, there’s also **GET\_FUNCTION\_NAME\_CHECKED**.
