Download

Loaded texture missing textureRHI

I’m trying to have a static class that lets me set the SplashScreen for VR from anywhere. There are multiple possible splash screens and I want static functions that set the appropriate screen.

The issue is that the first time a function is run and the appropriate texture is loaded, the texture->Resource->TextureRHI is nullptr. Running the function a second time (in the same tick) does not work either. It seems there must be a render pass after loading the texture before it works.

When I call UStereoLayerFunctionLibrary::SetSplashScreen via blueprint and pass in the same texture, it works.

Whats the difference and why does it go wrong in C++ on the first call?



class VRSplashScreen
{

public:
    /**
     *    Setting the SplashScreen just sets it to dirty and a render pass net to happen for unreal to set the screen finally.
     */
    static void SetSplashScreen(UTexture2D* texture)
    {
        // The Offset works just weired. No idea. Values seem to give a good result for placing the texture in front of the player.
        UStereoLayerFunctionLibrary::SetSplashScreen(texture, FVector2D(2.0f, 2.0f), FVector2D(-0.9f, -0.4f), false, true);
    }

    /**
     *    Set the VR SplashScreen to a loading image that shows 0%.
     *    Setting the SplashScreen just sets it to dirty and a render pass net to happen for unreal to set the screen finally.
     */
    static void SetSplashScreen_Loading0()
    {
        UTexture2D* texture = LoadObject<UTexture2D>(nullptr, TEXT("PATH_TO_TEXTURE"));
        check(texture);
        SetSplashScreen(texture);
    }

Hey,

have you ever found a solution for texture->Resource->TextureRHI is nullptr . We have the same issue and texture->Resource->InitRHI() is crashing on runtime.

Sorry for reviving this :wink: