Closed HafizMSaad closed 8 months ago
The Destroy
method is used to terminate the WebView native application running in the background. It is only called by OnDestroy
and OnApplicationQuit
, so it is my mistake to declare the Destroy method as a public function.
If you want to destroy the WebView at runtime, you need to use Object.Destroy
to destroy the WebView prefab. And if you want to instantiate the WebView, you should call Object.Instantiate
to create an instance of the WebView prefab.
Will utilising Object.Destroy ensure that my objective is met? Specifically, will it effectively terminate the web view and return control to my Unity application?
WebView prefab is used similarly to tabs in a common browser application. The prefab is instantiated in the Unity scene and the native WebView application is managed as a pair. If the WebView prefab is destroyed, the GameObject in the Unity scene and the native WebView application in the background are also destroyed. The number of WebView applications has a direct impact on the performance of Unity applications. Therefore, I think this approach is optimal.
I'm having trouble destroying the WebView prefab and returning to my app. Could you please provide a code snippet to help me with this task? What I'm attempting to do is destroy the TLabWebView
instance stored in m_webview
. The WebView itself disappears, but the search bar and keyboard remain visible.
I'm having trouble destroying the WebView prefab and returning to my app. Could you please provide a code snippet to help me with this task? What I'm attempting to do is destroy the
TLabWebView
instance stored inm_webview
. The WebView itself disappears, but the search bar and keyboard remain visible.
What worked for me: I called DeleteAll()
after setting the tag for all items in the sample scene (which are essentially webview elements). Then, I loaded my scene from which I navigated to the webview.
private void DeleteAll()
{
var gameObjects = GameObject.FindGameObjectsWithTag("web");
for (int i = 0; i < gameObjects.Length; i++)
{
Destroy(gameObjects[i]);
}
}
I'm not sure if this is an issue or a mistake on my part, but I discovered a "destroy" function. When I click the search button, I use it in the web view. However, nothing takes place. I assumed that the web view would end and return to my Unity application. I want to launch my app's web view upon some action and then return to it (my app) upon some other action in the web view.