Closed StefanCiobanu1989 closed 7 months ago
Hello.
GetUserAgent() is a function to retrieve the result obtained by CaptureUserAgent(), so please execute it like this.
public async void SampleUserAgent()
{
m_webView.SetUserAgent("Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0");
// The WebView is reloaded at this time.
// Therefore, it is better to execute LoadUrl() at a different time
// I will change it so that you can optionally specify whether to reload when setting the user agent
// Capture the current UserAgent
// m_webView.CaptureUserAgent()
// Wait a bit as the plugin runs asynchronously
await Task.Delay(500);
Debug.Log("User Agent: " + m_webView.GetUserAgent());
}
I will also add a function to get the URL later.
This is not a verified code and I may make some changes later...
out of curiosity, how many instances can you spawn before it gets laggy ? With just one instance and Web Width = 1280, Web Height 720, Tex Width 1280 Tex Height 720 it starts feeling sluggish , and if i spawn 4 more webviews it feels like it's 10FPS when moving my head around. Sorry to bother, but i need to figure out if i'm doing something wrong..
Reducing texture resolution may improve performance. When I publish my demos, I have the textures at half the resolution of WevView
Sorry for the very late update ...
I improved the rendering process of TLabWebView and benchmarked its performance.
I did not record the performance before the improvement, so I cannot compare it, but it should be somewhat better.
Video of benchmarking [web: 1024x1024, tex: 512:512]
GetUrl() has been integrated into the plugin, so please check it out.
Note that for Url and UserAgent, it is necessary to wait to retrieve the results until the page has finished loading.
hi again, bare with, more coffees are coming. I'm trying to assign an url on runtime to a webview but i have this loop :
The Webview is structured as such in my project :
The "duplicate" object from
duplicate.GetComponentsInChildren<TLabWebView>();
represents the assigned EmptyWebView object from the screenshot.Problem i'm having is:
dont seem to work as
textMesh.text = "UserAgent: "+ webView.GetUserAgent() + " Url: "+ webView.GetUrl();
results in UserAgent and Url being empty. The "url" variable does contain a text string.If something comes to mind please let me know. The webview is being found, the TextMeshPro object is being found but the set "SetUserAgent" and "LoadUrl" dont seem to get assigned. Thank you!
P.S. I have attempted to add a new function in the TLabWebView.cs called GetUrl() which should return the url on which the page is on, but because of this issue i cant really tell if it's working: