UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Utility Systems / Web Param System Completed

Utility Systems — UGTK

Web Param System

Summary

Reads query (?id=abc) and hash (#token=xyz) parameters from the page URL (WebGL Application.absoluteURL) and dispatches each value to a per-parameter UnityEvent, with an editor test URL for simulating parameters outside WebGL.


Content


Modules Dependencies

This module has no hard UGTK dependencies.


Setup

Drop the WebParam prefab into the scene — a GameObject with Mn_WebParam ready to configure:

Or add the Mn_WebParam component to a GameObject. Add one Binding per parameter you expect (set Variable Name, e.g. id, and wire its onValue(string) event). Configure the parsing options (Case Insensitive Names, Prefer Last Value On Duplicates, Url Decode Values, Also Read Hash Fragment) and, for editing/testing, enable Editor Test Url and set an editorTestUrl such as https://example.com/?id=abc&mode=dev#token=XYZ. Leave Auto Read On Start on to parse automatically in Start().


How To Use

On WebGL, opening .../index.html?id=ABC invokes the id binding's event with "ABC". In the editor/standalone the editorTestUrl is used instead (no network request).

The static ParseUrlParams(url, includeHash, urlDecode, preferLast, caseInsensitive) can parse any URL into a key/value dictionary. A key without = is treated as the flag value "true".

Good to know:


Testing Scene

Open WebParamScene in the module's Debug/ folder and select WebParam. The Editor Test Tools block at the bottom of the inspector does the whole thing with the editor stopped: no WebGL build, no upload, no address bar.

What to do, in order:

  1. Paste a URL into Test URL and press Parse the URL. The block lists every parameter it read.
  2. Dispatch it and watch the bindings fire.
  3. Remove one parameter from the URL and dispatch again.
  4. Try a parameter in the hash fragment rather than the query string.

Step 3 is the silent failure this system produces: a binding whose parameter is absent simply never fires, with nothing in the console. The inspector lists those bindings before you dispatch. All of this works without a WebGL build, which is the point — otherwise testing a binding means building, uploading and opening a link.


Technical Info


© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Depends on 0

  • Standalone: no other module required.

Used by 1

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 0 modules in total.