# Maintaining an FProperty\* of an UClass from plugin or external C++ code in Editor

**URL:** <https://forums.unrealengine.com/t/maintaining-an-fproperty-of-an-uclass-from-plugin-or-external-c-code-in-editor/1013410>\
**Category:** Pipeline & Plugins\
**Tags:** unreal-engine, question\
**Created:** [April 15, 2023, 11:53am UTC](https://forums.unrealengine.com/t/maintaining-an-fproperty-of-an-uclass-from-plugin-or-external-c-code-in-editor/1013410 "2023-04-15T11:53:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![balikamca](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@balikamca](https://forums.unrealengine.com/u/balikamca)\
**Post date:** [April 15, 2023, 11:53am UTC](https://forums.unrealengine.com/t/maintaining-an-fproperty-of-an-uclass-from-plugin-or-external-c-code-in-editor/1013410/1 "2023-04-15T11:53:56Z")

</div>

Hi.  
I’m doing some editor related C++ plugin development and I need to to maintain list of references to all FProperty’s of an spawned BP Actor, it should (also) work in Editor mode… _Also I need my FProperty references to be valid even after the related blueprint is recompiled._\*

`TArray<FProperty *> PropertiesOfSpawnedActor;`  
`Actor->GetClass()->PropertyLink //(collecting FPropert* references)`

I spawn an actor with C++ and right after I spawn the actor, I collect all FProperty’s and store them in an array.  
From now on, if you don’t touch anything, FProperties stay as valid…

But I need to handle “Blueprint recompile” event. After recompilation, I need to update my FProperty\* references so that they won’t reference to invalid locations.

For this purpose there is an excellent event which is:  
`FCoreUObjectDelegates::OnObjectsReplaced`

This event helps me to match old and new object. The problem is, before this event is broadcasted, somewhere in the code my spawned actor’s (private)class is being reinstanced…  
In another way, when I catch “OnObjectsReplaced” event, my Actor-\>GetClass() is already changed when compared to initally spawned case

Make a `Actor->GetClass()` call before and after recompiling, I get different UClass.  
Since I get different UClass, I cant match OldObject\<-\>NewObject properties.

So I want a delegate/method to be notified when a PrivateClass/UClass of and Actor is changed, so that I can track FPropert\* list…

Here is extra information:

In internals of Unreal, there are some places I found that are related with my problem. For example:

```auto
void UObjectBase::SetClass(UClass* NewClass)
{
...
ClassPrivate->CreatePersistentUberGraphFrame((UObject*)this, /*bCreateOnlyIfEmpty =*/false, /*bSkipSuperClass =*/false, OldClass); // THIS LINE CHANGES THE UCLASS 
}

```

In KismetReinstanceUtilities.cpp, there is a method that collects and maps old to new properties which is:

`void FBlueprintCompileReinstancer::GenerateFieldMappings(TMap<FFieldVariant, FFieldVariant>& FieldMapping)`

But I couldn’t find any code that broadcast this mapping information…
