Skip to content

Commit

Permalink
fixed SampleWebView.cs to check whether webViewObject exists. (gree#902)
Browse files Browse the repository at this point in the history
  • Loading branch information
KojiNakamaru authored Mar 30, 2023
1 parent 38493dc commit 37032e0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions sample/Assets/Scripts/SampleWebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,26 +206,26 @@ void OnGUI()
{
var x = 10;

GUI.enabled = webViewObject.CanGoBack();
GUI.enabled = (webViewObject == null) ? false : webViewObject.CanGoBack();
if (GUI.Button(new Rect(x, 10, 80, 80), "<")) {
webViewObject.GoBack();
webViewObject?.GoBack();
}
GUI.enabled = true;
x += 90;

GUI.enabled = webViewObject.CanGoForward();
GUI.enabled = (webViewObject == null) ? false : webViewObject.CanGoForward();
if (GUI.Button(new Rect(x, 10, 80, 80), ">")) {
webViewObject.GoForward();
webViewObject?.GoForward();
}
GUI.enabled = true;
x += 90;

if (GUI.Button(new Rect(x, 10, 80, 80), "r")) {
webViewObject.Reload();
webViewObject?.Reload();
}
x += 90;

GUI.TextField(new Rect(x, 10, 180, 80), "" + webViewObject.Progress());
GUI.TextField(new Rect(x, 10, 180, 80), "" + ((webViewObject == null) ? 0 : webViewObject.Progress()));
x += 190;

if (GUI.Button(new Rect(x, 10, 80, 80), "*")) {
Expand All @@ -239,22 +239,22 @@ void OnGUI()
x += 90;

if (GUI.Button(new Rect(x, 10, 80, 80), "c")) {
webViewObject.GetCookies(Url);
webViewObject?.GetCookies(Url);
}
x += 90;

if (GUI.Button(new Rect(x, 10, 80, 80), "x")) {
webViewObject.ClearCookies();
webViewObject?.ClearCookies();
}
x += 90;

if (GUI.Button(new Rect(x, 10, 80, 80), "D")) {
webViewObject.SetInteractionEnabled(false);
webViewObject?.SetInteractionEnabled(false);
}
x += 90;

if (GUI.Button(new Rect(x, 10, 80, 80), "E")) {
webViewObject.SetInteractionEnabled(true);
webViewObject?.SetInteractionEnabled(true);
}
x += 90;
}
Expand Down

0 comments on commit 37032e0

Please sign in to comment.