protected void setTextures(Texture ytex, Texture utex, Texture vtex) { if (null == ytex || null == utex || null == vtex) { return; } if (null == resultRT) { var res = Resources.Load <CustomRenderTexture>("YUV2RGBA"); resultRT = CustomRenderTexture.Instantiate(res); resultRT.material = new Material(Shader.Find("CustomRenderTexture/RT_YUV2RGBA")); resultRT.width = ytex.width; resultRT.height = ytex.height; resultRT.Initialize(); } if (resultRT != null) { resultRT.material.SetTexture("_YTex", ytex); resultRT.material.SetTexture("_UTex", utex); resultRT.material.SetTexture("_VTex", vtex); } }