I need help with my simple project. (I’m using 2020.3.18f)
- ‘Object1’(left object) is always showing, ‘Object2’(right object) is disabled at start, both contain a child object with text component.
- ‘RawImageWithVideoPlayer’ has raw image to show video, and also has video player to play video.
- ‘Script’ object has below script to control Object2 and video player
using UnityEngine;
using UnityEngine.Video;
public class ScriptForTest : MonoBehaviour
{
public VideoPlayer videoPlayer;
public GameObject object2;
void Start()
{
object2.SetActive(false);
videoPlayer.url = System.IO.Path.Combine(Application.streamingAssetsPath, "testVideo.mp4");
}
void Update()
{
if (Input.GetKeyDown(KeyCode.K))
{
if(videoPlayer.isPlaying)
videoPlayer.Stop();
else
videoPlayer.Play();
}
if (Input.GetKeyDown(KeyCode.L))
{
object2.SetActive(!object2.activeSelf);
}
}
}
4. after build and play my project, there is a problem :
text in Object2 is lost after enabled when video is playing. if video is not playing, text in Object2 shows correctly.
I want to know why this is happens. Is this a bug, or am I doing something wrong?

