# How to access a struct in blueprint from C++

**URL:** <https://forums.unrealengine.com/t/how-to-access-a-struct-in-blueprint-from-c/422273>\
**Category:** C++\
**Tags:** unreal-engine, CPP, Blueprint, question\
**Created:** [April 10, 2018, 8:44am UTC](https://forums.unrealengine.com/t/how-to-access-a-struct-in-blueprint-from-c/422273 "2018-04-10T08:44:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![xermao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xermao](https://forums.unrealengine.com/u/xermao)\
**Post date:** [April 10, 2018, 8:44am UTC](https://forums.unrealengine.com/t/how-to-access-a-struct-in-blueprint-from-c/422273/1 "2018-04-10T08:44:34Z")

</div>

I want to change a project to c++,but there is a problem,how can I access the struct define in blueprint from c++.

---

<div class="post-metadata">

**Author:** ![HarryHighDef](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HarryHighDef](https://forums.unrealengine.com/u/HarryHighDef)\
**Post date:** [April 10, 2018, 9:00am UTC](https://forums.unrealengine.com/t/how-to-access-a-struct-in-blueprint-from-c/422273/2 "2018-04-10T09:00:19Z")

</div>

You can’t, you can redefine the struct in c++ then change the bp refs over to the one made in C++

---

<div class="post-metadata">

**Author:** ![xermao](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xermao](https://forums.unrealengine.com/u/xermao)\
**Post date:** [April 10, 2018, 9:38am UTC](https://forums.unrealengine.com/t/how-to-access-a-struct-in-blueprint-from-c/422273/3 "2018-04-10T09:38:57Z")

</div>

Fine,thank you for your replay.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [April 10, 2018, 11:52pm UTC](https://forums.unrealengine.com/t/how-to-access-a-struct-in-blueprint-from-c/422273/4 "2018-04-10T23:52:14Z")

</div>

Actually there is a way to access BP struct variable via reflection system, everything oyu see in Blueprint can be done in C++, because blueprint is programmed in C++. But it’s more practical declaring structures in C++

---

<div class="post-metadata">

**Author:** ![woodzong](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@woodzong](https://forums.unrealengine.com/u/woodzong)\
**Post date:** [April 11, 2018, 2:10am UTC](https://forums.unrealengine.com/t/how-to-access-a-struct-in-blueprint-from-c/422273/5 "2018-04-11T02:10:43Z")

</div>

Use UStruct.  
Here the link [How\_To\_Make\_UStruct](https://wiki.unrealengine.com/How_To_Make_UStruct)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c91def4e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c91def4e](https://forums.unrealengine.com/u/anonymous_user_c91def4e)\
**Post date:** [January 29, 2021, 9:48am UTC](https://forums.unrealengine.com/t/how-to-access-a-struct-in-blueprint-from-c/422273/6 "2021-01-29T09:48:18Z")

</div>

Start by enumerating the properties:

```
UClass* MyBpClass = this->GetClass();
FProperty* MyPropertyLink = MyBpClass->PropertyLink;
while (MyPropertyLink)
{
    FString MyPropCppName = MyPropertyLink->GetNameCPP();
    FString MyPropCppTypeName = MyPropertyLink->GetCPPType();
    UE_LOG(Log, Log, TEXT("Label [%s] Type [%s] ..."), *MyPropCppName, *MyPropCppTypeName);
    FString Name = MyPropertyLink->GetName();
    MyPropertyLink = MyPropertyLink->PropertyLinkNext;
}

```
