@@ -16,6 +16,12 @@ public class WebViewManager : MonoBehaviour
1616 [ SerializeField ] private string defaultUrl = "https://www.google.com/" ;
1717 [ SerializeField ] private Vector2 normalizedTouchSlop = Vector2 . one * 0.05f ;
1818
19+ [ Header ( "Texture Properties" ) ]
20+ [ SerializeField ] private bool defaultMipChain = true ;
21+ [ SerializeField ] private FilterMode defaultFilterMode = FilterMode . Trilinear ;
22+ [ Range ( 0 , 16 ) ]
23+ [ SerializeField ] private int defaultAnisoLebel = 8 ;
24+
1925 [ Header ( "Events" ) ]
2026 [ SerializeField ] private UnityEvent < string > urlChanged = default ! ;
2127 [ SerializeField ] private UnityEvent < ReceivedData > dataReceived = default ! ;
@@ -24,6 +30,8 @@ public class WebViewManager : MonoBehaviour
2430 private WebViewDataReceiver ? receiver ;
2531 private WebViewTextureUpdater ? textureUpdater ;
2632
33+ public Texture Texture => webViewImage . texture ;
34+
2735 public void LoadUrl ( string url ) => bridge ? . LoadUrl ( url ) ;
2836 public void Reload ( ) => bridge ? . Reload ( ) ;
2937 public void GoBack ( ) => bridge ? . GoBack ( ) ;
@@ -37,7 +45,7 @@ private void Start()
3745
3846 var imageRectSize = webViewImage . rectTransform . sizeDelta ;
3947 var aspect = imageRectSize . y / imageRectSize . x ;
40- var textureHeight = ( int ) ( textureWidth * aspect ) ;
48+ var textureHeight = ( int ) Mathf . Abs ( textureWidth * aspect ) ;
4149
4250 var receiverObject = new GameObject ( id ) ;
4351 receiverObject . transform . parent = transform ;
@@ -56,7 +64,9 @@ private void Start()
5664 WebViewDataReceiver . JsonMessageMethodName
5765 ) ;
5866
59- var texture = new Texture2D ( textureWidth , textureHeight ) ;
67+ var texture = new Texture2D ( textureWidth , textureHeight , TextureFormat . RGBA32 , defaultMipChain ) ;
68+ texture . filterMode = defaultFilterMode ;
69+ texture . anisoLevel = defaultAnisoLebel ;
6070 webViewImage . texture = texture ;
6171
6272 textureUpdater = new WebViewTextureUpdater ( bridge , texture ) ;
0 commit comments