Sample project to make TLabWebView work on mobile
- Android 10 ~ 13
- Qualcomm Adreno 505, 619
- Unity: 2021.23f1
- Unity 2021.3.23f1
- TextMeshPro
- TLabVKeyborad
- TLabWebView
Clone the repository with the following command
git clone https://github.com/TLabAltoh/TLabWebViewSample.git
- Change platform to Android from Build Settings
- Add the following symbols to Project Settings --> Player --> Other Settings (to be used at build time)
UNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFIC
UNITYWEBVIEW_ANDROID_ENABLE_CAMERA
UNITYWEBVIEW_ANDROID_ENABLE_MICROPHONE
- Color Space: Linear
- Graphics: OpenGLES3
- Minimux API Level: 23
- Create Assets/Plugins/Android/AndroidManifest.xml and copy the following text
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools">
<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
<!-- For Unity-WebView -->
<application android:allowBackup="true"/>
<application android:supportsRtl="true"/>
<application android:hardwareAccelerated="true"/>
<application android:usesCleartextTraffic="true"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MICROPHONE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.microphone" />
<!-- For Unity-WebView -->
</manifest>- Open Assets/Scenes/SampleScene.unity
- Change the setting of WebView
Setting items in TLabWebView.cs (located in TLabWebView.prefab/WebView)
- Url: URL to load during WebView initialization
- DlOption: Whether to download to the application folder or the downloads folder
- SubDir: In case of setting download to application folder, it is downloaded to
{Application folder}/{files}/{SubDir} - Web (Width/Height): Web page resolution (default 1024 * 1024)
- Tex (Width/Height): Texture2D resolution used within Unity (default 512 * 512)
- Make sure that the canvas of Assets/TLabWebView is the screen space - camera, and attach the camera to be used when manipulating the WebView on the scene
