What are "GEN_VARIABLE" components?

I’m currently trying to battle a problem where a component I’m working with (during PostEditProperty) has its name suffixed with “_GEN_VARIABLE” (For instance, “StaticMeshComponent_GEN_VARIABLE”) and loses all of its internal connections back to its parent hierarchy. (If I call GetOwner() in this state, it returns null, it has no AttachParent, etc.)

Does anyone know what it means when a component is in this weird “GEN_VARIABLE” state? I’m guessing it’s doing something where it’s copying the editor changes into a new instance of the component, and then later inserts the new instance back into the actor’s component hierarchy? I’d like to know for sure, though, and if anyone can tell me how I can find my way back to the original actor from these GEN_VARIABLE components while they’re in an orphaned state, it’d be appreciated.

Did you ever resolve this? I’m hitting a similar issue: everything in MyComponent_GEN_VARIABLE is null.

Not fully.

I’m under the impression that GEN_VARIABLE components are transient, editor-only versions of the component which are created by the editor as part of the process of creating a CDO. They basically only exist momentarily when an object is edited, and then certain changes on them are copied to the actual asset you’re editing. The reason they have no component hierarchy is that no CDOs have component hierarchies, which has proven to be an enormous pain in the butt when trying to improve editor workflow with details customizations and such.

If you have access to the actor, you can locate the components and edit them following this process:

I don’t believe I was ever able to find the actor from the component, though. The relationship is one-way. I was completely unable to, for example, get all the names of all the other components on the actor from a component details customization.

I made a little bit of progress by guarding my code with:

HasAnyFlags(RF_ArchetypeObject)

Bit of a hack, as I don’t understand the true reason for *_GEN_VARIABLE

My solution was to cache the pointer. In the header:

class MyComp : public UActorComponent
{
        static TMap<FName, MyComp*> GenVars;

In the .cpp, I use a lambda to init the TMap:

TMap<FName, MyComp*> MyComp::GenVars = []() { TMap<FName, MyComp*> InitHack; return InitHack; }();

and in the constructor, I cache a reference:

MyComp::MyComp(const FObjectInitializer& ObjectInitializer) 
	: Super(ObjectInitializer)
{
    if (!HasAnyFlags(RF_ArchetypeObject))
    {
        UActorComponent* Comp = Cast<UActorComponent>(this);
        FName Key = FName(*FString::Printf(TEXT("%s_GEN_VARIABLE"), *(Comp->GetFName().ToString())));
	GenVars.Add(Key, this);
    }
}

Later, in a function that is called as part of my details customization:

MyComp** Comp = GenVars.Find(this->GetFName());
if(*Comp != nullptr)
{
    // do something with the real type

I have this same issue. Its frustrating not being able to access other component or the actor inside of PostEditChangeProperty