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.

Question Using IUsesCameraTexture to GetCameraTexture and store it to RenderTexture not working on iOS

Discussion in 'Unity MARS' started by azevedco, Jan 17, 2022.

  1. azevedco

    azevedco

    Joined:
    Mar 2, 2014
    Posts:
    34
    Hi there,
    We're working on an AR experience that uses the front facing camera and we need to render what the camera is seeing onto a RenderTexture used on a URP Lit material assigned to a quad in scene.

    We've found that it's only working on Android, but we're not getting any visuals on iOS.
    Here's our code:

    Code (CSharp):
    1. public class UserMirror : MonoBehaviour, IUsesCameraTexture
    2.     {
    3.         [SerializeField] private RenderTexture rendTexture = null;
    4.  
    5.         IProvidesCameraTexture IFunctionalitySubscriber<IProvidesCameraTexture>.provider { get; set; }
    6.  
    7.         // Start is called before the first frame update
    8.         void Start()
    9.         {
    10.             this.GetCameraTexture();
    11.         }
    12.  
    13.         // Update is called once per frame
    14.         void Update()
    15.         {
    16.             Texture camTex = this.GetCameraTexture();
    17.             Graphics.Blit(camTex, rendTexture);
    18.         }
    19.     }
    This is what the material looks like that's assigned to our quad:
    upload_2022-1-17_10-11-16.png

    Let me know if you need any further details and i'll try to respond as soon as possible.
    Cheers!
     
  2. CiaranWills

    CiaranWills

    Unity Technologies

    Joined:
    Apr 24, 2020
    Posts:
    165
  3. azevedco

    azevedco

    Joined:
    Mar 2, 2014
    Posts:
    34