Implemented by AndroidWebView to provide an alternative to IWebView.GetRawTextureData() that works without the graphics extensions that 3D WebView normally requires on Android (the OpenGL GL_OES_EGL_image_external extension or Vulkan VK_ANDROID_external_memory_android_hardware_buffer extension).
await webViewPrefab.WaitUntilInitialized();
var webViewWithFallbackTextureData = webViewPrefab.WebView as IWithFallbackTextureData;
if (webViewWithFallbackTextureData == null) {
Debug.Log("This 3D WebView plugin doesn't yet support IWithFallbackTextureData: " + webViewPrefab.WebView.PluginType);
return;
}
var textureData = await webViewWithFallbackTextureData.GetFallbackTextureData();
var texture = new Texture2D(
webViewPrefab.WebView.Size.x,
webViewPrefab.WebView.Size.y,
TextureFormat.RGBA32,
false,
false
);
texture.LoadRawTextureData(textureData);
texture.Apply();
Task<byte[]> GetFallbackTextureData()
Like IWebView.GetRawTextureData(), except it has the following differences: