Open ghost opened 6 years ago
Replace this function on line 416:
private void setTextures(Texture ytex, Texture utex, Texture vtex) { Material texMaterial = GetComponent<MeshRenderer>().material; texMaterial.SetTexture("_YTex", ytex); texMaterial.SetTexture("_UTex", utex); texMaterial.SetTexture("_VTex", vtex); }
With this:
private void setTextures(Texture ytex, Texture utex, Texture vtex) { Material texMaterial = null; if (GetComponent<Image>() != null) texMaterial = GetComponent<Image>().material; if (texMaterial == null) texMaterial = GetComponent<MeshRenderer>().material; texMaterial.SetTexture("_YTex", ytex); texMaterial.SetTexture("_UTex", utex); texMaterial.SetTexture("_VTex", vtex); }
Then remove the RequireComponent(typeof(MeshRenderer)) attribute from the Decoder class. You can now attach the decoder to an Image instead of a MeshRenderer.
Hi I am trying to figure out how to play a video on a uGUI canvas/texture?