# Setting TSubclassOf\<\> property in config

**URL:** <https://forums.unrealengine.com/t/setting-tsubclassof-property-in-config/315930>\
**Category:** C++\
**Tags:** modules, Perception, cdo, unreal-engine, config, CPP, question\
**Created:** [April 22, 2015, 11:27am UTC](https://forums.unrealengine.com/t/setting-tsubclassof-property-in-config/315930 "2015-04-22T11:27:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_eed5b8341](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_eed5b8341](https://forums.unrealengine.com/u/anonymous_user_eed5b8341)\
**Post date:** [April 22, 2015, 11:27am UTC](https://forums.unrealengine.com/t/setting-tsubclassof-property-in-config/315930/1 "2015-04-22T11:27:24Z")

</div>

Hi,

I’ve extended the _UAISense\_Sight_ by deriving from it by a _UAISense\_SightNew_ class. Now the _UAISenseConfig\_Sight_ has a property **TSubclassOf\< UAISense\_Sight \> Implementation;** where the default value of this property is loaded from config file.

I editted the **DefaultGame.ini** to set the Implementation property as following:  
**[/Script/AIModule.AISenseConfig\_Sight]  
Implementation=Class’/Script/ProjectName.AISense\_SightNew’**

The problem is that _ProjectName_ module is not yet loaded when the _UAISenseConfig\_Sight_ CDO is being created, what results in the **Implementation == NULL**.

Is there any way to fix this or am I bound to select this by hand in every instance of _UAISenseConfig\_Sight_ I create?

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [April 22, 2015, 12:29pm UTC](https://forums.unrealengine.com/t/setting-tsubclassof-property-in-config/315930/2 "2015-04-22T12:29:52Z")

</div>

Yeah, there’s a problem with configurable values that point at project-specific classes. A workaround for it would be to update that information upon your sense’s CDO (Class Default Object) creation, like so:

```
UAISense_SightNew::UAISense_SightNew(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
	if (HasAnyFlags(RF_ClassDefaultObject) == true)
	{
		UAISenseConfig_Sight* SightConfigCDO = GetMutableDefault<UAISenseConfig_Sight>();
		SightConfigCDO->Implementation = UAISense_SightNew::StaticClass();
	}
}

```

Hope it helps!

Cheers,

–mieszko

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_eed5b8341](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_eed5b8341](https://forums.unrealengine.com/u/anonymous_user_eed5b8341)\
**Post date:** [April 22, 2015, 12:54pm UTC](https://forums.unrealengine.com/t/setting-tsubclassof-property-in-config/315930/3 "2015-04-22T12:54:44Z")

</div>

Hey,  
maybe not a cleanest solution but works like a charm.  
Thanks for the quick response!

---

<div class="post-metadata">

**Author:** ![Okaminu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Okaminu](https://forums.unrealengine.com/u/Okaminu)\
**Post date:** [August 7, 2023, 11:57am UTC](https://forums.unrealengine.com/t/setting-tsubclassof-property-in-config/315930/4 "2023-08-07T11:57:14Z")

</div>

My less ideal workaround is using `FString ClassPath` instead, then `FindObject<UClass>(ClassPath)` then check it by `IsChildOf<UAISense_Sight>()`
