/// <summary> /// Standard MonoBehavior Start method, creates the TextureSet and internal WebView /// note that WebViews are uniquely named and requests for a WebView with an identical view name /// will reuse that view /// </summary> void Start() { TSet = new TextureSet(); TSet.Init(Width, Height, SmartRects); if (_windowId == 0) { _windowId = sWindowId; sWindowId++; // defaults to front BringToFront(false); } if (!JSPopup) { Command cmd = Command.NewCommand("CRVW", Name, Width, Height, SmartRects ? 1 : 0); cmd.Post().Process += processCRVW; } // listen in on inbound commands Plugin.ProcessInbound += processInbound; _mobileRect = new Rect(0, 0, Width, Height); _mobileRectDirty = false; if (JSPopup) { validate(); } }
/// <summary> /// Processes a resize of the UWKView, which can cause the backing textures to be /// released/allocated. This is an expensive operation and should be avoided if possible /// </summary> void processResize(object sender, CommandProcessEventArgs args) { Command cmd = args.Cmd; if (cmd.retCode > 0) { if (cmd.retCode == 2) { TSet.Release(); TSet = new TextureSet(); TSet.Init(Width, Height, SmartRects); } else { } } else { Debug.Log("Error Resizing View: " + Name); } }