Webviewer displays blank
Open
Nobody has claimed this yet.
- Dominant language
- Objective-C++
- Stars
- 2.7k
- Forks
- 734
- Avg merge
- 11h 39m
- Merged PRs (30d)
- 1
Description
I added WebViewObject.cs and a custom webview manager to a game object, however it only displays a solid dark gray. Here's my webview manager script. Tested on my Android 12 device:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class WebViewManager : MonoBehaviour
{
public string Url = "https://google.com";
public WebViewObject webViewObject;
IEnumerator Start()
{
int screenWidth = Screen.width;
int screenHeight = Screen.height;
webViewObject.Init((msg) =>
{
Debug.Log($"CallFromJS[{msg}]");
});
webViewObject.SetMargins(screenWidth / 4, screenHeight / 4, screenWidth / 4, screenHeight / 4);
webViewObject.SetVisibility(true);
#if !UNITY_WEBPLAYER && !UNITY_WEBGL
webViewObject.LoadURL(Url.Replace(" ", "%20"));
#else
webViewObject.LoadURL("StreamingAssets/" + Url.Replace(" ", "%20"));
#endif
yield break;
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the blank WebView on the reported Android 12 device using the provided WebViewManager, then read WebViewObject.cs around Init, SetMargins, SetVisibility, and LoadURL. Done means the configured URL renders instead of a solid dark-gray view.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, unity
- Domain
- game-dev, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100