API / CLASS REFERENCE
UltralightView
Inherits: TextureRect
Render HTML, CSS and JavaScript in a Godot TextureRect.
Render HTML, CSS and JavaScript in a Godot TextureRect. Initializes automatically after entering the tree with a nonzero size. Use load_url or load_html for runtime navigation, and UltralightAPI to install application bindings before page scripts and restore them after navigation. New evaluations use shared containers and explicit UltralightResult errors. Navigation, rebuild and close invalidate document handles and pending tasks. Logic and rendering run on the Godot frame loop; AppCore is not required.
Properties
Methods
set_accelerated(enabled: bool) → voidget_accelerated() → bool constis_accelerated() → bool constget_render_statistics() → Dictionary constset_max_render_fps(fps: int) → voidget_max_render_fps() → int constget_bridge_statistics() → Dictionary constunbind(name: String) → voidload_url(url: String, timeout: float = 30.0) → UltralightTaskload_html(html: String, base_url: String = "", timeout: float = 30.0) → UltralightTaskreload(timeout: float = 30.0) → UltralightTaskwait_ready(timeout: float = 30.0) → UltralightTaskwait_for_selector(selector: String, timeout: float = 30.0) → UltralightTaskevaluate(source: String) → UltralightResultevaluate_copy(source: String) → UltralightResultevaluate_handle(source: String) → UltralightResultevaluate_async(source: String, timeout: float = 30.0) → UltralightTaskis_closed() → bool constclose() → voidis_initialized() → bool constis_loading() → bool constis_document_ready() → bool constget_navigation_id() → int constget_current_url() → String constget_last_load_error() → UltralightError constinput_text(text: String) → voidscroll_pixels(delta: Vector2) → voidset_source_type(value: int) → voidget_source_type() → int constset_initial_url(value: String) → voidget_initial_url() → String constset_initial_html(value: String) → voidget_initial_html() → String constset_initial_base_url(value: String) → voidget_initial_base_url() → String constset_html_content(html: String) → voidget_html_content() → Stringset_html_url(htmlUrl: String) → voidget_html_url() → Stringset_transparent(is_transparent: bool) → voidget_transparent() → boolset_lazy(is_lazy: bool) → voidget_lazy() → boolrebuild() → voidinit_view() → voidbind_func(funcName: String, callback: Callable) → voidbind_object(name: String, object: Object, options: UltralightBindingOptions = null) → UltralightBindingbind_function(name: String, function: Callable, options: UltralightBindingOptions = null) → UltralightBindingbind_object_legacy(propertyName: String, instance: Object, query_members: bool = false) → voidexecute_script(script: String) → Variantfire_key_event(key_event: InputEventKey) → voidfire_mouse_event(position: Vector2, button_index: MouseButton, is_pressed: bool) → void
acceleratedbool
Request GPU rendering through Godot RenderingDevice. Configure before initialization. Compatibility, headless and unavailable devices use CPU Surface rendering. Use is_accelerated to check the actual backend. Reinitialization reloads the page.
Default: — · Accessors: set_accelerated() / get_accelerated()
max_render_fpsint
Limit this view's animation and repaint rate. Changes apply immediately and survive init_view. Zero removes the per-view limit; the SDK edition ceiling still applies (60 FPS for the public Free edition). Godot frame limits and VSync are independent.
Default: — · Accessors: set_max_render_fps() / get_max_render_fps()
source_typeint
Initial page source: 0 selects URL, 1 selects inline HTML.
Default: — · Accessors: set_source_type() / get_source_type()
initial_urlString
URL loaded during initial automatic initialization when source_type is 0.
Default: — · Accessors: set_initial_url() / get_initial_url()
initial_htmlString
HTML loaded during initial automatic initialization when source_type is 1.
Default: — · Accessors: set_initial_html() / get_initial_html()
initial_base_urlString
Base URL for relative resources in initial inline HTML.
Default: — · Accessors: set_initial_base_url() / get_initial_base_url()
document_readybool
Whether the current main document has reached DOM readiness. Read-only.
Default: — · Accessors: is_document_ready() · Read-only
current_urlString
Current main-document URL, separate from initial source configuration. Read-only.
Default: — · Accessors: get_current_url() · Read-only
htmlString
Legacy inline source setter. Prefer initial_html and source_type or runtime load_html.
Default: — · Accessors: set_html_content() / get_html_content()
htmlUrlString
Legacy URL source setter. Prefer initial_url or runtime load_url.
Default: — · Accessors: set_html_url() / get_html_url()
transparentbool
Enable a transparent page background. Configure before initialization. Changing it on an existing view requires reinitialization.
Default: — · Accessors: set_transparent() / get_transparent()
lazybool
Defer automatic initialization. Explicit load requests initialize after layout even when lazy is enabled.
Default: — · Accessors: set_lazy() / get_lazy()
set_accelerated
set_accelerated(enabled: bool) → voidSet accelerated.
get_accelerated
get_accelerated() → bool constReturn accelerated.
is_accelerated
is_accelerated() → bool constReturn whether this view actually uses GPU RenderingDevice. A request through accelerated can fall back to CPU if the device is unavailable or initialization fails.
get_render_statistics
get_render_statistics() → Dictionary constReturn rendering statistics. These fields are always present:
accelerated: actual rendering backend.sdk_edition,sdk_max_fps: SDK edition and its frame-rate ceiling; zero means no edition ceiling.max_render_fps: requested per-view frame-rate limit.ultralight_render_us: Ultralight rendering time in microseconds, shared across all views.cpu_page_upload_bytes,cpu_mipmap_count,cpu_upload_us: CPU Surface upload counters for this view. These survive reinitialization.
Only an active accelerated view adds GPU fields: gpu_available, bitmap_upload_bytes, geometry_upload_bytes, state_upload_bytes, draws, batches, feedback_copies, render_passes, rd_record_us, gpu_us and gpu_draws_by_shader. GPU counters cover all views. Zero GPU timing can mean timestamps are unavailable. GPU mode can still upload SDK resource bitmaps, including Canvas content.
CPU, uninitialized and fallback views omit GPU fields. Rendering preparation timings exclude JavaScript execution outside the render call and do not represent total application frame time.
set_max_render_fps
set_max_render_fps(fps: int) → voidSet max_render_fps.
get_max_render_fps
get_max_render_fps() → int constReturn max_render_fps.
get_bridge_statistics
get_bridge_statistics() → Dictionary constReturn counts of active bindings, host container proxies, host object proxies and retained JavaScript handles for diagnostics.
unbind
unbind(name: String) → voidRevoke the current temporary export with this name, including nested proxies.
load_url
load_url(url: String, timeout: float = 30.0) → UltralightTaskNavigate to url and return a task that completes at main-document DOM readiness. timeout is in seconds, finite and greater than zero. Before layout, the request waits for a usable size.
load_html
load_html(html: String, base_url: String = "", timeout: float = 30.0) → UltralightTaskLoad inline HTML with base_url for relative resources. Return a task for main-document DOM readiness; timeout is in seconds.
reload
reload(timeout: float = 30.0) → UltralightTaskReload the current page and return its DOM readiness task. An inline page retains its HTML and base URL.
wait_ready
wait_ready(timeout: float = 30.0) → UltralightTaskObserve the current main document. May complete immediately when already ready. Navigation invalidates an unfinished wait.
wait_for_selector
wait_for_selector(selector: String, timeout: float = 30.0) → UltralightTaskWait until a CSS selector matches an element in the current main document. Invalid selectors fail. This checks existence, not visibility.
evaluate
evaluate(source: String) → UltralightResultEvaluate source and return an explicit result. Arrays and objects are live shared handles; null is Nil and undefined is UltralightUndefined.
evaluate_copy
evaluate_copy(source: String) → UltralightResultEvaluate source and recursively copy own enumerable data into independent Godot containers. Cycles, unsupported values and depth over 64 fail.
evaluate_handle
evaluate_handle(source: String) → UltralightResultEvaluate source and retain its raw JavaScript value, including primitives, in an UltralightJSValue handle.
evaluate_async
evaluate_async(source: String, timeout: float = 30.0) → UltralightTaskEvaluate source and observe a returned Promise, or complete with an ordinary value. Timeout is in seconds. Navigation cancels delivery to the old document.
is_closed
is_closed() → bool constReturn whether close has permanently disabled this View.
close
close() → voidPermanently close this View, detach API registries, invalidate document handles and finish pending tasks.
is_initialized
is_initialized() → bool constReturn whether the native SDK View exists.
is_loading
is_loading() → bool constReturn whether the main document is loading.
is_document_ready
is_document_ready() → bool constReturn document_ready.
get_current_url
get_current_url() → String constReturn current_url.
get_last_load_error
get_last_load_error() → UltralightError constReturn the latest structured main-document load error, or null when no error is recorded.
input_text
input_text(text: String) → voidSend committed text to the focused page. This does not provide IME preedit or candidate-window positioning.
scroll_pixels
scroll_pixels(delta: Vector2) → voidSend a pixel scroll delta to the page.
set_source_type
set_source_type(value: int) → voidSet source_type.
get_source_type
get_source_type() → int constReturn source_type.
set_initial_url
set_initial_url(value: String) → voidSet initial_url.
get_initial_url
get_initial_url() → String constReturn initial_url.
set_initial_html
set_initial_html(value: String) → voidSet initial_html.
get_initial_html
get_initial_html() → String constReturn initial_html.
set_initial_base_url
set_initial_base_url(value: String) → voidSet initial_base_url.
get_initial_base_url
get_initial_base_url() → String constReturn initial_base_url.
set_html_content
set_html_content(html: String) → voidSet html.
get_html_content
get_html_content() → StringReturn html.
set_html_url
set_html_url(htmlUrl: String) → voidSet htmlUrl.
get_html_url
get_html_url() → StringReturn htmlUrl.
set_transparent
set_transparent(is_transparent: bool) → voidSet transparent.
get_transparent
get_transparent() → boolReturn transparent.
set_lazy
set_lazy(is_lazy: bool) → voidSet lazy.
get_lazy
get_lazy() → boolReturn lazy.
rebuild
rebuild() → voidRecreate the native View to apply backend configuration. Invalidates old document state and tasks; attached API registries are restored for the new document.
init_view
init_view() → voidCompatibility alias for rebuilding. Automatic initialization and explicit load methods handle ordinary layout and loading.
bind_func
Compatibility function export. New code should use bind_function or UltralightAPI.register_function.
bind_object
bind_object(name: String, object: Object, options: UltralightBindingOptions = null) → UltralightBindingExport a temporary Godot Object with optional UltralightBindingOptions. Return its revocable binding. Use UltralightAPI.register_object for persistent exports or root Array and Dictionary containers.
bind_function
bind_function(name: String, function: Callable, options: UltralightBindingOptions = null) → UltralightBindingExport a temporary global function and return its revocable UltralightBinding. For navigation persistence use UltralightAPI.
bind_object_legacy
Compatibility entry for the old query_members boolean. New code should use UltralightAPI and UltralightBindingOptions.
execute_script
Compatibility evaluation using copied values and Nil/logged errors. Prefer evaluate for explicit errors and shared values.
fire_key_event
fire_key_event(key_event: InputEventKey) → voidForward a keyboard event to an initialized page. Normal Control input forwards key events while the web view has focus.
fire_mouse_event
fire_mouse_event(position: Vector2, button_index: MouseButton, is_pressed: bool) → voidForward a mouse event to an initialized page. position uses coordinates local to the web view, in pixels. Pass MOUSE_BUTTON_NONE for motion, a mouse button with is_pressed for press/release, or a wheel button for scrolling. The Control normally forwards its own GUI input automatically.
Signals
load_started
load_started(event: UltralightFrameEvent)Main-document loading has started.
window_ready
window_ready(event: UltralightFrameEvent)Main-document global is available. API registries are installed, and page scripts have not yet executed.
dom_ready
dom_ready(event: UltralightFrameEvent)Main-document DOM is ready. State is updated before dispatch. Does not imply application async work is finished.
frame_dom_ready
frame_dom_ready(event: UltralightFrameEvent)Any frame DOM is ready, including the main frame. Inspect event.is_main_frame and event.frame_id.
load_finished
load_finished(event: UltralightFrameEvent)Main-document loading finished. Does not guarantee permanent network inactivity.
load_failed
load_failed(failure: Dictionary)Main-document failure. failure contains event, error, domain and code.
console_message
console_message(message: Dictionary)Page console entry. Includes level, message, source_url, line, column and navigation_id when available.
on_window_object_ready
on_window_object_ready()Compatibility signal. Prefer window_ready(event) and persistent UltralightAPI registrations.
on_dom_ready
on_dom_ready()Compatibility main-document DOM signal. Prefer dom_ready(event); iframe notifications use frame_dom_ready(event).
Internal lifecycle callbacks
on_update_frame
on_update_frame() → voidInternal lifecycle callback. Publishes the rendered texture after Godot drawing. It is connected automatically; applications should not invoke it.
on_resized
on_resized() → voidInternal lifecycle callback. Resizes an initialized page to match the Control. It is connected automatically; applications should not invoke it.