Unity VideoPlayer 播放无声音

增加一个videoPlayer下挂,audiorSource脚本

this.videoPlayer.EnableAudioTrack(0, true);
this.videoPlayer.audioOutputMode = VideoAudioOutputMode.AudioSource;
this.videoPlayer.SetTargetAudioSource(0, this.videoPlayer.GetComponent());

设置没问题,但是发现无音效。

去掉PlayOnAwake之后,可以正常发声了。

初步判断,mp4自带音轨没法预加载,playOnAwake会导致自动播放时没预载好音效。

你可能感兴趣的:(unity,游戏引擎)