-
Notifications
You must be signed in to change notification settings - Fork 704
Need help with web view content #694
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
Comments
It seems rather an issue about html and not webview. How do you add an image to your content? |
Is your implementation based on this plugin? It seems different one. Also, if you need to place small images over the svg, I think it is better to add them as html elements. Then you won't need to worry about zooming. For example, thhe sample app of this plugin with the following diff shows a small image at diff --git a/sample/Assets/Scripts/SampleWebView.cs b/sample/Assets/Scripts/SampleWebView.cs
index d4fd613..05a1bd6 100644
--- a/sample/Assets/Scripts/SampleWebView.cs
+++ b/sample/Assets/Scripts/SampleWebView.cs
@@ -108,6 +108,7 @@ public class SampleWebView : MonoBehaviour
"};");
#endif
webViewObject.EvaluateJS(@"Unity.call('ua=' + navigator.userAgent)");
+ webViewObject.EvaluateJS(@"PutSmallImage(20, 30)");
},
//transparent: false,
//zoom: true,
diff --git a/sample/Assets/StreamingAssets/sample.js b/sample/Assets/StreamingAssets/sample.js
index 8dc3fc4..1892ac2 100644
--- a/sample/Assets/StreamingAssets/sample.js
+++ b/sample/Assets/StreamingAssets/sample.js
@@ -9,4 +9,15 @@ window.addEventListener(
msg.textContent = '(NOTE: the background color was changed by sample.js, for checking whether the external js code works)';
},
3000);
+ window.PutSmallImage = function(x, y) {
+ Unity.call("here");
+ var img = document.createElement('img');
+ img.src = "sample.jpg";
+ img.width = 32;
+ img.height = 32;
+ img.style.position = "absolute";
+ img.style.left = x + "px";
+ img.style.top = y + "px";
+ document.body.appendChild(img);
+ };
}); |
Thank you very much for your solution, but can you tell me more if I use your plan, can I move that thumbnail to another location or delete it because my application is written in Objective-C iOS has those functions, thank you very much |
If you use unity-webview, you can utilize EvaluateJS() to evaluate any javascript code, so that you can dynamically add/move/delete images. If you don't utilize unity-webview and implement your app with objc, you can utilize https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript?language=objc . |
Great, I will try your solution and give feedback later, many thanks |
Thanks, I'll check it out.
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 1:14 CH, Th 5, 3 thg 6, 2021 Koji Nakamaru ***@***.***>
đã viết:
… If you use unity-webview, you can utilize EvaluateJS() to evaluate any
javascript code, so that you can dynamically add/move/delete images. If you
don't utilize unity-webview and implement your app with objc, you can
utilize
https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript?language=objc
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5CHPWB7DBLYQ5HX7SLTQ4MT7ANCNFSM454NHIMA>
.
|
This plugin just overlays native webviews over unity's rendering view, so any click on webviews cannot be directly detected by unity (cf. NOTE described at https://github.com/gree/unity-webview/tree/ed0ceef5a366b1185da49ef4ec50088b2a3516e2#unity-webview ). Therefore, you should receive click events with javascript and send information of them to the unity side with |
Thanks, I'll check it out.
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 4:12 CH, Th 5, 17 thg 6, 2021 Koji Nakamaru ***@***.***>
đã viết:
… This plugin just overlays native webviews over unity's rendering view, so
any click on webviews cannot be directly detected by unity (cf. NOTE
described at
https://github.com/gree/unity-webview/tree/ed0ceef5a366b1185da49ef4ec50088b2a3516e2#unity-webview
). Therefore, you should receive click events with javascript and send
information of them to the unity side with Unity.call(). The following
might be helpful:
#693 (comment)
<#693 (comment)>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5F4YWUGEO6B6WQNVGDTTG36BANCNFSM454NHIMA>
.
|
Maybe you did something wrong. The following change for the sample app works correctly. Please also refer https://www.w3schools.com/jsref/obj_mouseevent.asp about events. diff --git a/sample/Assets/Scripts/SampleWebView.cs b/sample/Assets/Scripts/SampleWebView.cs
index e8aa466..bec989c 100644
--- a/sample/Assets/Scripts/SampleWebView.cs
+++ b/sample/Assets/Scripts/SampleWebView.cs
@@ -108,6 +108,12 @@ public class SampleWebView : MonoBehaviour
"};");
#endif
webViewObject.EvaluateJS(@"Unity.call('ua=' + navigator.userAgent)");
+ webViewObject.EvaluateJS(@"document.addEventListener(
+ 'click',
+ function(evt) {
+ Unity.call(evt.offsetX + ',' + evt.offsetY);
+ },
+ false);");
},
//transparent: false,
//zoom: true, |
I followed your suggestions and now I am having 2 problems: 2: I don't understand why but I can only use the available image file sample.jpg to display thumbnails on WebView but when using an image I manually add to the Project like Note_Solid.png, the thumbnail cannot be displayed. OK. All of my code is in SampleWebView.cs and I will send you below along with all the Assets I use for You to test. Hope You can suggest me a solution, thanks |
The sample app won't load a svg file directly. The following part extracts jpg/js/html files from StreamingAssets and loads the html file by LoadURL(). unity-webview/sample/Assets/Scripts/SampleWebView.cs Lines 144 to 173 in ed0ceef
An easy solution would be to rename your svg file to |
Thanks, I'll check it out.
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 9:19 SA, Th 3, 22 thg 6, 2021 Koji Nakamaru ***@***.***>
đã viết:
… The sample app won't load a svg file directly. The following part extracts
jpg/js/html files from StreamingAssets and loads the html file by LoadURL().
https://github.com/gree/unity-webview/blob/ed0ceef5a366b1185da49ef4ec50088b2a3516e2/sample/Assets/Scripts/SampleWebView.cs#L144-L173
An easy solution would be to rename your svg file to sample.svg and embed
it in sample.html. If you utilize the sample app as is, you also need to
add ".svg" to exts. Similarly about 2 you can rename your png file to
sampe.png and add ".png" to exts.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5D3K2LSXPETHKSJLBLTT7XMDANCNFSM454NHIMA>
.
|
The above problem I will solve according to your suggestion, many thanks. |
You cannot overlay any unity rendering over webviews, as discussed in #694 (comment) . You could realize such a list of UI in javascript/html or hide the webview while a user is picking a svg. |
Thanks, I'll check it out.
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 8:55 CH, Th 3, 22 thg 6, 2021 Koji Nakamaru ***@***.***>
đã viết:
… You cannot overlay any unity rendering over webviews, as discussed in #694
(comment)
<#694 (comment)>
. You could realize such a list of UI in javascript/html or hide the
webview while a user is picking a svg.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5EZAFDGLSOD6LQ5LELTUCI5LANCNFSM454NHIMA>
.
|
Your status bar might be scaled depending on the screen resolution. SetMargin() sets margins in device pixel units, so if you specify the top margin 60, the status bar's height should always be 60 in device pixel units. If you realize the status bar as a uGUI image, its rect transform should be as below: |
Thank you for the clarification.
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 9:51 CH, Th 4, 23 thg 6, 2021 Koji Nakamaru ***@***.***>
đã viết:
… Your status bar might be scaled depending on the screen resolution.
SetMargin() sets margins in device pixel units, so if you specify the top
margin 60, the status bar's height should always be 60 in device pixel
units. If you realize the status bar as a uGUI image, its rect transform
should be as below:
[image: image]
<https://user-images.githubusercontent.com/2645978/123118733-d8e7c300-d47d-11eb-9514-b38bfa9d3d43.png>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5FJ3ZTX3F7QXYNWFHDTUHYIFANCNFSM454NHIMA>
.
|
Currently I have a problem in calling a function that passes a string parameter from C# to JS and vice versa: |
unity-webview/sample/Assets/Scripts/SampleWebView.cs Lines 58 to 80 in 166cb03
If you can edit the html, you can define <html>
<head>
...
<script>
if (window && window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.unityControl) {
window.Unity = {
call: function(msg) {
window.webkit.messageHandlers.unityControl.postMessage(msg);
}
}
} else {
window.Unity = {
call: function(msg) {
window.location = 'unity:' + msg;
}
}
}
</script>
...
</head>
...
</html> then you don't need to define it in the |
Thanks, I'll check it out.
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 9:16 SA, Th 2, 12 thg 7, 2021 Koji Nakamaru ***@***.***>
đã viết:
… Unity.call() is natively defined for Android but not for iOS. For iOS, it
is defined in the ld: callback:
https://github.com/gree/unity-webview/blob/166cb032a96da97bfa86fd2ac568b7063ec1239f/sample/Assets/Scripts/SampleWebView.cs#L58-L80
If you can edit the html, you can define Unity.call() in the html:
<html>
<head>
...
<script>
if (window && window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.unityControl) {
window.Unity = {
call: function(msg) {
window.webkit.messageHandlers.unityControl.postMessage(msg);
}
}
} else {
window.Unity = {
call: function(msg) {
window.location = 'unity:' + msg;
}
}
}
</script>
...
</head>
...</html>
then you don't need to define it in the ld: callback.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5ERS4QS6DIWIWQHYDDTXJF6RANCNFSM454NHIMA>
.
|
Thank you very much for the suggestion but sorry to bother you again because I have checked and found that Unity.call is still running OK on iOS, as evidenced when I click on the WebView on iOS I called Unity.call and transmit Click coordinates from HTML + JS to Unity + C# as Log below I copied from XCode: Above all, my problem right now is that I can call back and forth between HTML + JS and Unity + C# if there is no String data in the parameter list, but if so, my code will just run. on Android but not on iOS and here is how I code, please refer below and give me your opinion, thanks HTML + JS code: trong đó _id + _url là 2 tham số kiểu String I will attach to you the HTML + JS file I use for your convenience Debug |
For the sample app, I put your ViewNote.html and ViewNote.js under StreamingAssets and copied sample.jpg to ViewNote.jpg: set Url to ViewNote.html: and changed SampleWebView.cs: diff --git a/sample/Assets/Scripts/SampleWebView.cs b/sample/Assets/Scripts/SampleWebView.cs
index e8aa466..46a62e8 100644
--- a/sample/Assets/Scripts/SampleWebView.cs
+++ b/sample/Assets/Scripts/SampleWebView.cs
@@ -30,6 +30,7 @@ public class SampleWebView : MonoBehaviour
public string Url;
public Text status;
WebViewObject webViewObject;
+ int id;
IEnumerator Start()
{
@@ -40,6 +41,15 @@ public class SampleWebView : MonoBehaviour
Debug.Log(string.Format("CallFromJS[{0}]", msg));
status.text = msg;
status.GetComponent<Animation>().Play();
+ if (msg.StartsWith("Anh.NT: OnPointerClick"))
+ {
+ var pos = msg.Replace("Anh.NT: OnPointerClick|", "").Split('|');
+ Debug.Log(string.Format(@"({0}, {1})", pos[0], pos[1]));
+ var nid = "note" + id++;
+ webViewObject.EvaluateJS(string.Format(@"AddBackgroundForViewNote('{0}', '{1}')", nid, "ViewNote.jpg"));
+ webViewObject.EvaluateJS(string.Format(@"document.getElementById('{0}').style.left='{1}px'", nid, pos[0]));
+ webViewObject.EvaluateJS(string.Format(@"document.getElementById('{0}').style.top='{1}px'", nid, pos[1]));
+ }
},
err: (msg) =>
{ With this modified sample app, I can tap on iPhone screen to add ViewNote.jpg: |
Thanks, I'll check it out.
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 12:05 CH, Th 4, 14 thg 7, 2021 Koji Nakamaru ***@***.***>
đã viết:
… For the sample app, I put your ViewNote.html and ViewNote.js under
StreamingAssets and copied sample.jpg to ViewNote.jpg:
[image: image]
<https://user-images.githubusercontent.com/2645978/125564013-31b9ec7a-e24a-4016-bc83-9b2b16165eb8.png>
set Url to ViewNote.html:
[image: image]
<https://user-images.githubusercontent.com/2645978/125564064-c735fa88-20a9-49e4-8a72-3be4d855e12a.png>
and changed SampleWebView.cs:
diff --git a/sample/Assets/Scripts/SampleWebView.cs b/sample/Assets/Scripts/SampleWebView.cs
index e8aa466..46a62e8 100644--- a/sample/Assets/Scripts/SampleWebView.cs+++ b/sample/Assets/Scripts/SampleWebView.cs@@ -30,6 +30,7 @@ public class SampleWebView : MonoBehaviour
public string Url;
public Text status;
WebViewObject webViewObject;+ int id;
IEnumerator Start()
{@@ -40,6 +41,15 @@ public class SampleWebView : MonoBehaviour
Debug.Log(string.Format("CallFromJS[{0}]", msg));
status.text = msg;
status.GetComponent<Animation>().Play();+ if (msg.StartsWith("Anh.NT: OnPointerClick"))+ {+ var pos = msg.Replace("Anh.NT: OnPointerClick|", "").Split('|');+ Debug.Log(string.Format(@"({0}, {1})", pos[0], pos[1]));+ var nid = "note" + id++;+ webViewObject.EvaluateJS(string.Format(@"AddBackgroundForViewNote('{0}', '{1}')", nid, "ViewNote.jpg"));+ webViewObject.EvaluateJS(string.Format(@"document.getElementById('{0}').style.left='{1}px'", nid, pos[0]));+ webViewObject.EvaluateJS(string.Format(@"document.getElementById('{0}').style.top='{1}px'", nid, pos[1]));+ }
},
err: (msg) =>
{
With this modified sample app, I can tap on iPhone screen to add
ViewNote.jpg:
[image: sc]
<https://user-images.githubusercontent.com/2645978/125564479-2a03a408-bb3f-4387-b77c-72545f0d1b9a.png>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5GJGMNRNDP3AI6F2LTTXULLPANCNFSM454NHIMA>
.
|
Thanks for help. I tried on Sample Project same as You and yes My Code is ok on both Android and iOS but when I try again on My own Project everything is same, on Android OK but iOS not and I detect Out of all the lines of code that I write in Unity + C# to call HTML + JS, I would like to ask you if there is any special setup required for Project to be able to call HTML + JS from Unity + C# , thank you! |
There is no special setup to invoke |
Thanks, I'll check it out.
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 11:09 CH, Th 4, 14 thg 7, 2021 Koji Nakamaru ***@***.***>
đã viết:
… There is no special setup to invoke EvalulateJS() (unity+c# -> html+js).
You should track down the issue step by step and figure out which part
doesn't work. If Unity.call() (html+js -> unity+c#) seems not working,
you may miss its definition, which I discussed before: #694 (comment)
<#694 (comment)>
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5DD5Q5PIOKTBV7GIBLTXWZDRANCNFSM454NHIMA>
.
|
Many thanks, I will continue to try on your Sample Project and will depend on the results that may have to ask You for further assistance. |
Here is a minimum sample.html which demonstrates how to drag an image. <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Unity WebView</title>
<style>
* {
-webkit-user-select: none;
}
</style>
<script>
window.addEventListener(
'load',
function() {
var img = document.querySelector('img');
var x0;
var y0;
var r0;
img.addEventListener(
'touchstart',
function(event) {
event.preventDefault();
var t = event.touches[0];
x0 = t.pageX;
y0 = t.pageY;
r0 = event.target.getBoundingClientRect();
},
false);
img.addEventListener(
'touchmove',
function(event) {
event.preventDefault();
var t = event.touches[0];
var x1 = t.pageX;
var y1 = t.pageY;
event.target.style.left = (r0.x + x1 - x0) + 'px';
event.target.style.top = (r0.y + y1 - y0) + 'px';
},
false);
img.addEventListener(
'touchend',
function(event) {
event.preventDefault();
},
false);
},
false);
</script>
</head>
<body>
<img src="sample.jpg" style="position: absolute;" />
</body>
</html> |
Awesome, thanks!
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 11:01 CH, Th 5, 9 thg 9, 2021 Koji Nakamaru ***@***.***>
đã viết:
… Here is a minimum sample.html which demonstrates how to drag an image.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Unity WebView</title>
<style>
* {
-webkit-user-select: none;
}
</style>
<script>
window.addEventListener(
'load',
function() {
var img = document.querySelector('img');
var x0;
var y0;
var r0;
img.addEventListener(
'touchstart',
function(event) {
event.preventDefault();
var t = event.touches[0];
x0 = t.pageX;
y0 = t.pageY;
r0 = event.target.getBoundingClientRect();
},
false);
img.addEventListener(
'touchmove',
function(event) {
event.preventDefault();
var t = event.touches[0];
var x1 = t.pageX;
var y1 = t.pageY;
event.target.style.left = (r0.x + x1 - x0) + 'px';
event.target.style.top = (r0.y + y1 - y0) + 'px';
},
false);
img.addEventListener(
'touchend',
function(event) {
event.preventDefault();
},
false);
},
false);
</script>
</head>
<body>
<img src="sample.jpg" style="position: absolute;" />
</body></html>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5H2N32WTTGSIBMQ2LDUBDK5NANCNFSM454NHIMA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I think the black square is the Drag/Drop function available on WKWebView, when I hold down an img tag, it will immediately appear a black square with the same avatar as the img tag and when I move my finger, the black square will appear. scroll like the image below so I want to ask you if you have any way to disable Drag/Drop function on WKWebView? Thank you. |
Did you try the sample.html described in #694 (comment) ? It shows no black square when you drag the image. iOS WKWebView itself doesn't have any drag-specific function which displays such a black square. As noted before, it should be caused by your javascript, javascript libraries you utilize, and/or html/css. |
I tried on Your Sample Project and when I Run the Sample.html file on Safari, I tap and hold on the img tag (src = SVG file) the thing in the red circled area like the image below appears and I think when running on iOS it it's Black Square but when I run it on iOS, img tag can't load SVG file like when I open Sample.html file on Safari, Can you tell me where am I missing, I don't edit much Sample Project Yours except disabling wkAllowsLinkPreview on WKWebView and Selectable on HTML like what We discussed above. |
Please try the sample app as is except sample/Assets/StreamingAssets/sample.html which should be replaced with the one described in #694 (comment) . |
It happens only on PC and is not related to WKWebView on iOS. You can also find various information on the net, such as https://stackoverflow.com/questions/704564/disable-drag-and-drop-on-html-elements . |
I used event.preventDefault() in touchstart() event and it worked, thanks for your quick support. |
Thanks, I'll check it out.
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 1:46 CH, Th 5, 16 thg 9, 2021 Koji Nakamaru ***@***.***>
đã viết:
… It happens only on PC and is not related to WKWebView on iOS. You can also
find various information on the net, such as
https://stackoverflow.com/questions/704564/disable-drag-and-drop-on-html-elements
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5G6GJKGHAVMRBUJ3WDUCGHFVANCNFSM454NHIMA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I need to hide horizontal and vertical scrollbar on WebView, in both Android and iOS platforms, Can you give me a solution? Thank you. |
As there was no convenient way for hiding scrollbars, I added |
Will do, thanks!
===== Gửi từ Gmail của Nguyễn Tùng Anh =====
Vào 11:39 CH, Th 7, 6 thg 11, 2021 Koji Nakamaru ***@***.***>
đã viết:
… As there was no convenient way for hiding scrollbars, I added SetScrollbarsVisibility(bool
visibility) in #750 <#750> and
updated binaries. Could you please try the latest?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#694 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC2FY5E4QA3QSFLAQT64JO3UKVK5NANCNFSM454NHIMA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Your above solution works great, thanks. Now I have another problem that I need your help with, I need to disable scrolling on WebView, is there any way to solve it? |
Adding the following should prevent scrolling. body {
overflow: hidden;
position: fixed;
width: 100%;
} The following is a complete demo based on #694 (comment) . <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Unity WebView</title>
<style>
* {
-webkit-user-select: none;
}
body {
overflow: hidden;
position: fixed;
width: 100%;
}
</style>
<script>
window.addEventListener(
'load',
function() {
var img = document.querySelector('img');
var x0;
var y0;
var r0;
img.addEventListener(
'touchstart',
function(event) {
event.preventDefault();
var t = event.touches[0];
x0 = t.pageX;
y0 = t.pageY;
r0 = event.target.getBoundingClientRect();
},
false);
img.addEventListener(
'touchmove',
function(event) {
event.preventDefault();
var t = event.touches[0];
var x1 = t.pageX;
var y1 = t.pageY;
event.target.style.left = (r0.x + x1 - x0) + 'px';
event.target.style.top = (r0.y + y1 - y0) + 'px';
},
false);
img.addEventListener(
'touchend',
function(event) {
event.preventDefault();
},
false);
},
false);
</script>
</head>
<body>
<img src="sample.jpg" style="position: absolute;" />
</body>
</html> |
As described in https://docs.unity3d.com/Packages/[email protected]/manual/script-InputField.html,
It is the native input field attached to the onscreen keyboard. It is not directly displayed by uGUI. |
But the photo above I took on an Android device? |
Turning "Hide Mobile Input" on is only allowed for iOS. The state of "Hide Mobile Input" turned off is default for both platforms and you said you turned it off. |
Okay, although its behavior differs from the description on the manual and recently it might also be supported for Android. |
My problem is still I can't display anything on WebView (eg Scene, UI Element: Panel, Button, ...) and I see [Mobile Input] display on WebView so I want to ask Do you know how [Mobile Input] can do that? |
This is done by OS's software keyboard function, so it is called "native" input field. As the software keyboard is over webview, the native input field, which is the part of the software keyboard, is also over webview. It is not rendered by Unity. |
I found your article [https://github.com//issues/587] and I thought it would solve my problem, but when I check on [Render Over Native UI] in [Player Setting] the WebView can't be displayed anymore? Can you help me to solve this issue? |
As noted in #584, a user cannot interact with webview. It is basically useless. |
Can you help me Screen Shot WebView? Using Unity's Screen Shot function can't Screen Shot WebView? |
Unity's ScreenCapture.CaptureScreenshot() captures only unity's rendering view. In Asset Store, there might be an asset that allows to capture the whole screen. |
Currently I have 1 problem: I need to add an image to the content of the web view so that when zooming the web view, that image is also zoomed, please help me, thanks


The text was updated successfully, but these errors were encountered: