Download

Bug with vertex color overrides on blueprints

Anyone know why component instance data doesn’t seem to be either saved or loaded for ‘native’ created components?

Stepping through the FComponentInstanceDataCache, it appears that component instance data is not created or applied to components that are ‘natively’ defined, such as via CreateDefaultSubobject. This means that things custom vertex painting will not be retained by the blueprint if you attempt to create a blueprint out of an actor that defines native components, such as when trying to make a ‘room’ blueprint out of a collection of actors that have vertex coloring.

I have a custom actor type which defines a UStaticMeshComponent in the constructor like so


StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(FName(TEXT("StaticMesh")));

I have instances of these actors in a map, where our environment artist is painting them with override vertex coloring, like this test object. The larger wall piece is the static mesh referenced by the natively defined StaticMeshComponent on my actor. The other pieces are standalone actors.

If you select these objects, and do a “Convert Selection to Blueprint Class”, in “Child Actors” mode, the colors will not transfer, and the object has none of the color information in the resulting blueprint. If you use “Harvest Components” mode, the vertex color data is retained. Using harvest mode is inadequate though for some situations.

Stepping through the code, it appears related to the FComponentInstanceDataCache not saving or loading component instance data for ‘native’ defined components, so since the Static Mesh Component of each actor is where the color data is defined, it doesn’t get saved or reapplied. Harvest mode effectively harvests the components into the blueprint in a way that retains its component instance data.

I reported this as a bug as it is clearly a bug but I was hoping someone had a workaround handy.