title: How do you update a UTextureRenderTarget2D dynamically in C++?
body: <p>I've been trying, but failing to do it with this code</p>
  
  <pre><code>UTextureRenderTarget2D *renderTarget; // In header
  
  void UMyActorComponent::BeginPlay()
  {
      Super::BeginPlay();
      texture = UTexture2D::CreateTransient(1, 1);
      FTexture2DMipMap&amp; Mip = texture-&gt;PlatformData-&gt;Mips[0];
      void* Data = Mip.BulkData.Lock(LOCK_READ_WRITE);
      uint8 red[4] = { 255, 255, 255, 255 };
      FMemory::Memcpy(Data, &amp;red, sizeof(red));
      Mip.BulkData.Unlock();
      texture-&gt;UpdateResource();
  
      renderTarget-&gt;UpdateTexture2D(texture, TSF_BGRA8);
  }
  </code></pre>
  
  <p>I at least know for a fact I have the correct handle to the renderTarget, because I've been able to clear the render target. I might be missing something simple any help is appreciated.</p>