How to save modified Texture2D asset in editor code or blueprint?

First off, I had to use UpdateTextureRegions() to update the texture. I’ve seen many posts that use this:

	Mip->BulkData.Lock(LOCK_READ_WRITE);
	uint8* TextureData = (uint8 *) Mip->BulkData.Realloc(height * width * sizeof(uint8)*4);
	FMemory::Memcpy(TextureData, pixels, sizeof(uint8) * height * width * 4);
	Mip->BulkData.Unlock();

This does absolutely nothing for me. It does work for reading though.

With UpdateTextureRegions(), it does update visibly on the static mesh and in my editor widget, but when I save the texture, it reverts back to what it was.

What do I have to do to update and save a pre-existing texture asset?

I had searched for a really long time (several days) unable to find the answer. So of course, immediately after posting this thread, I find the answer here:

While the block of code I posted above doesn’t work on the live mip data, it does work on UTexture2D::Source. You just call LockMip(0) and UnlockMip(0) to write the data. Set the package to dirty and you can save it manually.

So UpdateTextureRegions() to update the live data. And UTexture2D::Source.LockMips() to update the persistent data.