Display
)Display
)1920x1080
view.may_render = false
to toggle renderingSay you have a big level; an indoor and outdoor area. Indoors, there is a computer you can interact with, and it is rendered with our webview (of course). Now, whenever you are outside you don't really want to spend CPU/GPU cycles on rendering a computer you cannot see.
Previously, you could use $WebView.may_render = false
, or $WebView.process_mode = PROCESS_MODE_DISABLED
to stop
the rendering, but this then requires manual setup of an Area3D to determine
if the player is in the vicinity.
For this reason, you can now add an Area3D to the webview node directly, like so:
And then in the WebView properties you can pass a CharacterBody3D
:
With this setup, whenever your CharacterBody3D
enters/exits the Area3D, the webview's rendering is toggled.
We recommend doing this if you have a large level, with a large amount of webviews, as there is no point in rendering things you cannot see.
Under the hood, this Area3D toggles the view.may_render
property.