Announcement

Collapse
No announcement yet.

UTexture2D::UpdateResource() not working in packaged application

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    UTexture2D::UpdateResource() not working in packaged application

    In my project I'm making heavy use of "raw" texture updates, like this:

    Code:
    	// Calc buffer size
    	size_t BufferSize = BackgroundTextureSize.X * BackgroundTextureSize.Y * 4 * sizeof(uint8);
    
    	// Lock resource and get raw data (READ WRITE)
    	uint8 *RawData = (uint8*)BackgroundTexture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
    	if (!RawData)
    	{
    		UE_LOG(LogTemp, Warning, TEXT("ResetBackgroundImage(): cannot read background texture data!"));
    		return;
    	}
    
    	// Copy
    	memcpy(RawData, BackgroundTextureDataCache, BufferSize);
    
    	// Release resource
    	BackgroundTexture->PlatformData->Mips[0].BulkData.Unlock();
    	// Update resource
    	BackgroundTexture->UpdateResource();
    Everything works fine in PIE, Standalone Game and even Mobile Preview.
    However, when I package the project for Windows (in development configuration) and launch the game, textures do not update. Why? Did I miss something?
    Main links:
    SneppyChannel
    PoliSquad
    Turbosquid 3D models

    #2
    What version of @UnrealEngine 4 are you using - and experiencing this problem ??

    [:]D

    Comment


      #3
      Originally posted by dr.purple View Post
      What version of @UnrealEngine 4 are you using - and experiencing this problem ??
      Version is 4.13.2
      Main links:
      SneppyChannel
      PoliSquad
      Turbosquid 3D models

      Comment


        #4
        I tried in 4.10 and still nothing
        Then I tried using UpdateTextureRegions method (which should be faster than locking/unlocking/updating resource): works in editor, crashes in packaged game.
        Finally I created a whole new project (4.13) copying just a little part of the code (with UpdateTextureRegions), packaged it on the fly and it works!

        Any idea what could be the problem with the original project? Maybe I messed up with settings? I really need to fix this, since the whole project revolves around it.

        EDIT: tested on 3 w10x64 devices, on two of them (mid and high end) the unhandled exception is an ACCESS_VIOLATION, on the other one a INT_DIVIDED_BY_ZERO. The problem is caused by the UpdateTextureRegions call. Anyway a few times it worked without throwing any exception ...
        Last edited by Sneppy; 01-29-2017, 07:49 PM.
        Main links:
        SneppyChannel
        PoliSquad
        Turbosquid 3D models

        Comment

        Working...
        X