# Is there a simple way to get class variable values

**URL:** <https://forums.unrealengine.com/t/is-there-a-simple-way-to-get-class-variable-values/350864>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [March 17, 2016, 4:41pm UTC](https://forums.unrealengine.com/t/is-there-a-simple-way-to-get-class-variable-values/350864 "2016-03-17T16:41:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_adc3f730](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_adc3f730](https://forums.unrealengine.com/u/anonymous_user_adc3f730)\
**Post date:** [March 17, 2016, 4:41pm UTC](https://forums.unrealengine.com/t/is-there-a-simple-way-to-get-class-variable-values/350864/1 "2016-03-17T16:41:44Z")

</div>

This is my current setup to getting current blueprint variable values from class.  
Is there a way to do this but without spawning an actor to get the variable value?  
i feel there is a much more simpler/efficient way to do this.

```
FActorSpawnParameters SpawnParams;
SpawnParams.Owner = this;
SpawnParams.Instigator = Instigator;
FTransform TempTransform;

AActor* const TempSpawnObject = GetWorld()->SpawnActor<AActor>(MyBlueprintClass, TempTransform.GetLocation(), TempTransform.GetRotation().Rotator(), SpawnParams);

if (TempSpawnObject)
{
        ACustomActor* const CustAct = Cast<ACustomActor>(TempSpawnObject);

        if(CustAct)
        {
                CustAct->ReadCustomVariableValue
        }
        TempSpawnObject->Destroy();
}

```

---

<div class="post-metadata">

**Author:** ![MiKom](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MiKom](https://forums.unrealengine.com/u/MiKom)\
**Post date:** [March 17, 2016, 9:33pm UTC](https://forums.unrealengine.com/t/is-there-a-simple-way-to-get-class-variable-values/350864/2 "2016-03-17T21:33:46Z")

</div>

Every UClass has static function `GetDefaultObject()` that returns “default” object for this class. By default I mean a version that doesn’t really exist in the world, but has all the values set as right after constructor invocation and blueprint-side defaults (if it’s blueprint class).

You can then cast this object to your desired type withouth the need for spawning temporary object of the class.

Commonly in documentation and forums this object is called **CDO** or Class Default Object
