AddToGameObject() public static method

Dynamically adds a UWKWebView component to a GameObject with initialization that isn't possible using GameObject.AddComponent due to lack of constructor parameters
public static AddToGameObject ( GameObject gameObject, string url = "", int maxWidth = 1024, int maxHeight = 1024 ) : UWKWebView,
gameObject GameObject
url string
maxWidth int
maxHeight int
return UWKWebView,
    // Create a new tab (requires Pro for > 1 UWKWebView)
    void createTab(string url = "http://www.google.com")
    {
        if (numTabs == 4)
        {
            return;
        }

        Tab t = tabs[numTabs];

        t.URL = url;

        t.View = UWKWebView.AddToGameObject(gameObject, url, Width, Height);

        t.View.URLChanged   += urlChanged;
        t.View.TitleChanged += titleChanged;
        t.View.LoadProgress += loadProgress;
        t.View.LoadFinished += loadFinished;
        // clear default handler
        t.View.NewViewRequested  = null;
        t.View.NewViewRequested += newViewRequested;

        t.Title = "";

        tabs[numTabs] = t;

        numTabs++;
    }
    // Use this for initialization
    void Start()
    {
        windowRect = new Rect(X, Y, Width + 8, Height + 8 + toolbarHeight);

        view = UWKWebView.AddToGameObject(gameObject, URL, Width, Height);

        Center();
    }
Beispiel #3
0
    void Start()
    {
        windowRect = new Rect(X, Y, Width + 16, Height + 16);

        view = UWKWebView.AddToGameObject(gameObject, FacebookLoginSite, Width, Height);
        view.JSMessageReceived += onJSMessage;
        view.Hide();

        Center();
    }