Open weacw opened 4 years ago
报错显示了Try to use "using (WindowProvider.of(BuildContext).getScope()) { ... }",用了uiwidgets的地方 应该 `
using (WindowProvider.of(BuildContext).getScope()) {
rt = renderTexture;
var videoPlayer = this.gameObject.AddComponent<VideoPlayer>();
videoPlayer.clip = this.videoClip;
videoPlayer.targetTexture = renderTexture;
videoPlayer.isLooping = true;
videoPlayer.sendFrameReadyEvents = true;
videoPlayer.frameReady += (_, __) => Unity.UIWidgets.widgets.Texture.textureFrameAvailable();
videoPlayer.Play();
} `
报错显示了Try to use "using (WindowProvider.of(BuildContext).getScope()) { ... }",用了uiwidgets的地方 应该 `
using (WindowProvider.of(BuildContext).getScope()) {
rt = renderTexture; var videoPlayer = this.gameObject.AddComponent<VideoPlayer>(); videoPlayer.clip = this.videoClip; videoPlayer.targetTexture = renderTexture; videoPlayer.isLooping = true; videoPlayer.sendFrameReadyEvents = true; videoPlayer.frameReady += (_, __) => Unity.UIWidgets.widgets.Texture.textureFrameAvailable(); videoPlayer.Play();
} `
我是这么用的,this.gameObject 指的是场景中挂载了UIWidgetPanel的GameObject,没有报错,希望对你有帮助!
环境信息
Unity:2019.4f1 UIWidget git拉取 2020/07/21
Code
于
Unity.UIWidgets.widgets.Texture.textureFrameAvailable();
出错。 因为Window instance = null
导致的。log