Search Unity

Using webcam as background

Discussion in 'AR/VR (XR) Discussion' started by jetroid88, Apr 19, 2018.

  1. jetroid88

    jetroid88

    Joined:
    Apr 18, 2018
    Posts:
    8
    I'm trying to make an app that uses the front camera of an Android device as a background, but I'm not sure what code I should use, currently I have this:

    var deviceName = WebCamTexture.devices[0].name;

    var webCamTexture = new WebCamTexture(deviceName, 1280, 720, 30);

    webCamTexture.Play();


    renderer.material.mainTexture = webCamTexture;

    But I am not sure what I need to add to get it to actually work.

    Any help would be appreciated

    Thanks.