Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #1119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,21 @@ If you start from the `sample` project, most of the time you just have to commen

Please also note that the Init function of the `Assets/Plugins/Editor/UnityWebViewPostprocessBuild.cs` has a lot of parameters and can be quite long.

The play mode of the editor is not well supported, always try on a real build.

If you encounter an issue, try the sample app.

If you have a blank screen, it is most likely that you used HTTP (instead of HTTPS) or self signed certificates. In this case, please refer to the `use Cleartext Traffic` section of this README.

You can call JS functions via Unity with the webViewObject.EvaluateJS() function even if your JS is served by a server. However, you cannot launch Unity functions from JS.
To do this, you will either have to use [this repo](https://github.com/zouloux/unity-web-view) or to create a JS->Server->Unity.
You can call JS functions via Unity with the webViewObject.EvaluateJS() function even if your JS is served by a server. However, you cannot "directly" launch Unity functions from JS.
Here is three potentials ways to mitigate this issue :
- Use Unity.call('something') to send 'something' to the msg of the cb (for callback) function of the sample app. So you can say Unity.call('Function1') then in the cb say if(msg == 'Function1'){Function1()}
- Use [this repo](https://github.com/zouloux/unity-web-view)
- Create a JS->Server->Unity.
If you create a fork that allows a remote Unity to JS communication, feel free to fork this repo, add the functionality and submit your changes via a clear and well described Pull Request

If you want to pass clicks and touches to Unity and the click is in the webview area, it will not work. If you really want, you can try this experimental branch : https://github.com/gree/unity-webview/pull/584 enable 32bits and renderoverui and create a Mask on the area you want unity to take control.

**Warning** : Carefully look at the ```#if``` and ```#endif``` because they make parts of the code run or not run depending on the platform and the Editor version.
You sometimes have to look at them to be sure that the code you add or edit will be executed.

Expand Down Expand Up @@ -158,14 +167,15 @@ cf. https://github.com/gree/unity-webview/issues/785
cf. https://github.com/gree/unity-webview/issues/224#issuecomment-640642516

### Android

Since `Assets/Plugins/src` is deprecated in recent Unity versions, we switched to .aar files (Android Archive Library).
If you need to edit some AndroidManifest.xml files :
1. Opening the `plugin`folder of this repo in Android Studio
2. Make somes changes (most of the time edit the `plugin/Android/webview/src/main/AndroidManifest.xml`).
3. Build the app
4. You will see your aar file in `build/outputs/aar/`
5. Move this file to `Assets/Plugins/Android/`
#### How does it work ?
It works on Android by calling a new android activity which implements a webview. We pass arguments from Unity to this activity to control it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this part describe? The current implementation doesn't utilize any special activity.


#### File Input Field

Expand Down