Seamless Portals

On my side the RenderTarget is setup like this (inside my ScriptedTexture class, which is inherited from SceneComponent).

Header:


    private:
        UPROPERTY()
        UCanvasRenderTarget2D* ScriptedTexture;

Body:



//Function to call at runtime when you create the RenderTarget.
void Init()
{
   ScriptedTexture = UCanvasRenderTarget2D::CreateCanvasRenderTarget2D( GetWorld(), UCanvasRenderTarget2D::StaticClass(), SizeX, SizeY );

    if( ScriptedTexture == nullptr || !ScriptedTexture->IsValidLowLevel() )
    {
        return;
    }

    //"Attach" the resource to the class, to avoid garbage collection
    ScriptedTexture->AddToRoot();

    //Specify here some properties
    ScriptedTexture->Filter = TextureFilter::TF_Bilinear;

    //Binding of the Update function, where we draw things
    ScriptedTexture->OnCanvasRenderTargetUpdate.AddDynamic(this, &UExedreScriptedTexture::OnReceiveUpdate);

    //Call the draw function of the RenderTarget
    ScriptedTexture->UpdateResource();
}

If you crash, it’s likely because something is not valid, etc. You should look at the callstack to get more information.