/// <summary>Opens a window of the given type with the given title and URL.</summary>
        public static PowerToolsWindow OpenWindow(System.Type type, string title, string url)
        {
            // Show existing window instance. If one doesn't exist, make one.
            PowerToolsWindow window = EditorWindow.GetWindow(type) as PowerToolsWindow;

            // Start editor svc:
            EditorWebAPI.Setup();

            // Give it a title:
                        #if PRE_UNITY5_3
            window.title = title;
                        #else
            GUIContent t = new GUIContent();
            t.text = title;
            window.titleContent = t;
                        #endif

            // Open the PowerTools window:
            window.WebView = WebHelpers.Open(window, url);

            // Cache the size:
            window.Width  = window.position.width;
            window.Height = window.position.height;

            return(window);
        }
Пример #2
0
        /// <summary>Starts the web API.</summary>
        public static void Setup()
        {
            if (Current == null)
            {
                Current = new EditorWebAPI();
            }

            Current.Start();
        }