Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

WebCamTexture not working with Il2CPP on iOS and MacOS

Discussion in 'iOS and tvOS' started by V0odo0, Apr 26, 2022.

  1. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    321
    Unity 2021.2.7f. This simple script not executing properly on iOS and Mac builds compiled with IL2CPP. It just shows a grey texture with no errors or warnings. Tested on clean fresh project.

    Code (CSharp):
    1. public class WebCamTextureTest : MonoBehaviour
    2. {
    3.     public RawImage RawImage;
    4.  
    5.     // Start is called before the first frame update
    6.     void Start()
    7.     {
    8.         WebCamTexture t = new WebCamTexture(WebCamTexture.devices.First().name);
    9.         t.Play();
    10.         RawImage.texture = t;
    11.     }
    12.  
    13.     // Update is called once per frame
    14.     void Update()
    15.     {
    16.        
    17.     }
    18. }
    No issues in Editor. MacOS buit with Mono works fine as well as Windows & Android builds compiled with IL2CPP.

    Looks like a bug to me but haven't found anything related to this problem on the forums or issue tracker. Can someone test it out to make sure that this is a common Il2CPP bug?