// PlayerTwo for Unity WebGL: the one component it makes (the owner, 2026-12-03: "Build these: ... Unity and Godot bridges // in the browser"). P2 makes it by itself on the first call, on a hidden object that lasts across scenes; it hands each // answer and event to your callbacks in Update, before your own scripts' Update, so a callback never runs inside the call // that asked. Nothing to add to a scene. Docs: https://playertwo.plus/docs/sdk/engines using UnityEngine; namespace PlayerTwoSdk { [DefaultExecutionOrder(-10000)] [AddComponentMenu("")] public sealed class P2Runner : MonoBehaviour { static P2Runner made; internal static bool Made { get { return made != null; } } internal static void Make() { if (made != null || !Application.isPlaying) return; var go = new GameObject("PlayerTwo"); go.hideFlags = HideFlags.HideInHierarchy; DontDestroyOnLoad(go); made = go.AddComponent(); } void Update() { P2.Drain(); } void OnDestroy() { if (made == this) made = null; } } }