Add a WebView
node to your scene. In the node inspector, you can configure things like
the URL to browse, refresh-rate, zoom, etc.
To display the webview in your Godot project, you have 3 options:
Below are the 2 easiest methods:
To render the webview fullscreen:
TextureRect
as a child-nodeTo render the webview onto a 3D plane:
MeshInstance3D
as a child-nodeMeshInstance3D
a PlaneMesh
in the inspectorThen, attach a script to your scene, with the following code:
func _ready():
$WebView.connect("view_ready", _on_view_ready)
func _on_view_ready():
$WebView.load()
view_ready
is a signal that is emitted when the webview is ready, at which point we can call load()
.
load()
will result in a pink texture._process
or _input
methods of the WebView
.That's it!
Please note this is the "basic" way of using the webview where it automatically sets up mouse and keyboard event handlers. For more advanced usage: