Getting pc.rendertarget (as source) from secondary cam to cubemap.rendertarget

I have tried to combine knowledge from How to make a dynamic cubemap ? (reflexion project) and ☑ Save specific rendered entities to image (as well as yaustar’s referenced https://playcanvas.com/editor/code/605131?tabs=17966832)

without luck …

My last attemp of ‘Getting pc.rendertarget (as source) from secondary cam to cubemap.rendertarget’ strands at:


DynCubemap.prototype.onMouseDown = function (event) {
var asset = this.app.assets.get(26314379); //Getting the CubeMap
var texture = this.app.assets.resource;

var colorBuffer = new pc.Texture(this.app.graphicsDevice, {
    width: 512,
    height: 512,
    format: pc.PIXELFORMAT_R8_G8_B8
});
                                                     
var renderTarget = new pc.RenderTarget(this.app.graphicsDevice, texture, {
    colorBuffer: colorBuffer,
    depth: true,
    face: 0
});

var layer = this.app.scene.layers.getLayerByName(this.layerName);              
layer.renderTarget = renderTarget;
                                                     
var cam = this.app.root.findByName("Camera2"); console.log("cam.name: "+cam.name); var camAsCam = cam.camera; 
renderTarget =camAsCam.renderTarget.colorBuffer.getSource;
                                                                             
asset.loadFaces = true;
this.app.assets.load(asset);
this.app.setSkybox(renderTarget);
};

[numerous times the ‘cam’ or ‘camAsCam’ gets console-debugged with error of not existing]