two webcams into a single rawimage side-by-side,How to have two webcams in the same rawimage side by side

Hello. I’ve been able to capture streams of different webcams simultaneously using the code found here unity-webcam/MobileCam.cs at master · Chamuth/unity-webcam · GitHub and simply creating two rawimages, each one with attached a similar script. However I would need to have the two streams in just a single rawimage, side-by-side, for 3D purposes. I was thinking to copy the two rawimages in one but I don’t think this is efficient and, beside, I’m new to Unity so not sure how to do it.
Any suggestion?

Why can’t the WCTs be in 2 raw images right next to each other??

If you really need them to be displayed as one raw image, I think you will have to create that single texture2D at runtime every frame, but this seems like a very strange use case. Anyhow, this is untested, but I think more or less what you are trying to do:

Texture2D texture;

WebCamTexture wctOne;
WebCamTexture wctTwo;

RawImage rawCamImage;

void Start()
    rawCamImage = GetComponent<RawImage>();
    wctOne = new WebCamTexture( WebCamTexture.devices[0].name, Screen.width / 2, Screen.height, 30 );
    wctTwo = new WebCamTexture( WebCamTexture.devices[1].name, Screen.width / 2, Screen.height, 30 );
    StartCoroutine( StartCams() );
IEnumerator StartCams()

    while( wctOne.width < 100 || wctTwo.width < 100 )
                yield return null;

    texture = new Texture2D( wctOne.width + wctTwo.width, wctOne.height, TextureFormat.RGB24, false );

    rawCamImage.texture = texture;
    rawCamImage.material.mainTexture = texture;
        yield return null;

@highpockets Thank you: I will give it a try. I need the two side by side to be rendered in a single rawimage in order to exploit a Leia component that will automatically handle it to show it 3D in their 3D screens (Lume Pad for example). Normally any side-by-side image in their texture2D becomes 3D

Anyway there is something wrong (even if you comment the part about the second cam to get a single webcam working, the rawImage is empty)