Hey there !
I’m following this topic and my code is nearly identical to what @PEYMAN has posted.
How to create textures at runtime and assign them to a mesh? - #3 by PEYMAN
UTexture2D* CustomTexture = UTexture2D::CreateTransient(32, 32);
FTexturePlatformData** PlatformData = CustomTexture->GetRunningPlatformData();
FTexture2DMipMap FirstMip = (*PlatformData)->Mips[0];
FByteBulkDataOld ImageData = FirstMip.BulkData;
uint8* RawImageData = static_cast<uint8*>(ImageData.Lock(LOCK_READ_WRITE));
int TextureSize = 32 * 32;
for(auto i = 0; i < TextureSize; i += 4)
{
RawImageData[i] = 255;
}
ImageData.Unlock();
CustomTexture->UpdateResource();
However when I try to compile I get this error:
unresolved external symbol “public: virtual struct FTexturePlatformData * * __cdecl UTexture2D::GetRunningPlatformData(void)” (?GetRunningPlatformData@UTexture2D@@UEAAPEAPEAUFTexturePlatformData@@anonymous_user_9674a66c) referenced in function “public: void __cdecl AThreadActor::SwapTexture(void)” (?SwapTexture@AThreadActor@@QEAAXXZ)
Does anyone know how to resolve this ? I’m using UE5 Preview 2.