Android webview in Unity3d (C #)

I am using a game application using single3d for Android. In this case, I will display one warning window that displays a message like “Do you want to go to click“ OK ”or“ Cancel. ”If the user clicks“ ok ”, I want to rewrite them to some web page, for example,“ / overflow.site / ....

This is possible in android using the Android code for Android. Now my question is: how can I use this webview in Unity3d (C # code).

I searched the net and got the following links:

https://github.com/gree/unity-webview

https://github.com/kimsama/unity3d-webview-csharp

I downloaded these codes. But I could not complete these samples. If anyone has used these samples, please give me the steps to complete them. or someone can give me other samples.

+4
source share
2 answers

I created a similar gree webview-based WebView plugin in which I modified some code to run in the Mac Editor (and, of course, you can use it in both iOS and Android). The repo also has a valid demo. You can try.

UniWebView - Unity3D web view plugin for iOS, Android and Mac

+4
source

My team had the same case, except that we wanted something that works with both 2D and 3D. We examined various options and ended up using the Unity 3D WebView plugin . This is what our code looks like:

void ShowWebView(Vector3 position) { var webPrefab = WebViewPrefab.Instantiate(0.5f, 0.5f); // specify the size webPrefab.transform.parent = this.transform; webPrefab.transform.position = position; webPrefab.transform.LookAt(Camera.main.transform); webPrefab.Initialized += (sender, e) => webPrefab.WebView.LoadUrl("https://example.com"); } 
0
source

Source: https://habr.com/ru/post/1491781/


All Articles