[C++] Get Vertex Color Value in Packaged Build

Hey everyone
I’m trying to get painted vertexes color values but i’m having some issues getting it to work in packaged builds.

Here i retrieve the FColorVertexBufferand and initialize it, with this i can get correct results in editor, but in the packaged build, all of the colors in the array return 221,221,221,221. Have anyone else had this issue?
Note that my mesh is set to Allow CPU Access.

Is there anything else i have to do for to get the correct values from the buffer?

I tried experimenting with FColorVertexBuffer->InitResources, UpdateRHI etc. but nothing seems to make it work.

Current:

FColorVertexBuffer* ColorBuffer = &vertexPaintDetectionHitMeshComp->GetStaticMesh()->RenderData->LODResources[0].VertexBuffers.ColorVertexBuffer;

ColorBuffer->Init(ColorBuffer->GetNumVertices(), true);

ColorBuffer->GetVertexColors(colorTestArray);

why do you call Init() ? just call GetVertexColors()

Thanks for your reply!

Because if i don’t call init, the colors just return 255,0,0,255 in both editor and build, which is the default color of the Static Mesh Vertices.

By initializing, it gives me the right values in the editor. But maybe it is wrong and there is something else completely that needs to be done?
I’m suspecting there might be something more in the Static Mesh Settings except the Allow CPU Access that have to be changed.

Have you done something similar before and could provide some examples? :slight_smile: