# C++ How to cast Data Blueprint Parent class with changed variables?

**URL:** <https://forums.unrealengine.com/t/c-how-to-cast-data-blueprint-parent-class-with-changed-variables/482435>\
**Category:** C++\
**Tags:** parent-class, unreal-engine, CPP, question\
**Created:** [April 25, 2021, 12:28pm UTC](https://forums.unrealengine.com/t/c-how-to-cast-data-blueprint-parent-class-with-changed-variables/482435 "2021-04-25T12:28:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crakmaks](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Crakmaks](https://forums.unrealengine.com/u/Crakmaks)\
**Post date:** [April 25, 2021, 12:28pm UTC](https://forums.unrealengine.com/t/c-how-to-cast-data-blueprint-parent-class-with-changed-variables/482435/1 "2021-04-25T12:28:14Z")

</div>

Hi everyone,  
I really hope you can help me out.  
The core problem is: I have a Data Blueprint with MyClass as Parent. I just can’t get it cast back to MyClass with the changed variables. I’m stuck somewhere at:

```
MyClass* MC = Cast<MyClass>(Blueprintclass->ParentClass.Get()->StaticClass());

```

The only thing that casts valid is Blueprintclass-\>ParentClass.GetDefaultObject() but without my changed values in the Blueprint. Please help me out!  
Thanks

---

<div class="post-metadata">

**Author:** ![Crakmaks](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Crakmaks](https://forums.unrealengine.com/u/Crakmaks)\
**Post date:** [April 25, 2021, 8:08pm UTC](https://forums.unrealengine.com/t/c-how-to-cast-data-blueprint-parent-class-with-changed-variables/482435/2 "2021-04-25T20:08:04Z")

</div>

I finally found the Solution!

```
UBlueprint* BlueprintAsset = Cast<UBlueprint>(AssetsList*.GetAsset());
if (BlueprintAsset)
{
	TSubclassOf<AWeapon> SubclassOfWeapon = BlueprintAsset->GeneratedClass;
}

```

You can read more about it here:  
[https://forums.unrealengine.com/t/how-to-access-default-values-of-blueprint-assets/60884](https://forums.unrealengine.com/t/how-to-access-default-values-of-blueprint-assets/60884)
