Solution: set the render texture initialization color to transparent.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;
public class VideoPlayerFixBlackScreen : MonoBehaviour
{
public int width = 848;
public int height = 480;
public RawImage rawImage;
VideoPlayer vp;
void Start()
{
vp = GetComponent<VideoPlayer>();
var renderTexture = new CustomRenderTexture(width, height);
renderTexture.initializationColor = new Color(0f, 0f, 0f, 0f);
vp.targetTexture = renderTexture;
rawImage.texture = renderTexture;
}
}
Top comments (0)