예제 #1
0
        // OnEnable is called when the game starts, or when the manager script component is enabled.
        public virtual void OnEnable()
        {
                        #if UNITY_EDITOR && !UNITY_WEBPLAYER
            if (HtmlFile != null && WatchForChanges)
            {
                // Get the full asset path:
                string fullPath = UnityEditor.AssetDatabase.GetAssetPath(HtmlFile);

                // Create the loader:
                Reloader = new LiveHtml(fullPath,
                                        delegate(string path, string html){
                    // Write the innerHTML now:
                    Document.innerHTML = html;
                }
                                        );
            }
                        #endif

            // Start:
            UI.Start();

            // Load the main UI from the above HtmlFile or Url. Note that UI's don't have to be loaded like this! You
            // can also just set a string of text if needed.
            Navigate(UI.document);
        }
예제 #2
0
        // OnDisable is called when the manager script component is disabled. You don't need this.
        public virtual void OnDisable()
        {
            UI.Destroy();

                        #if UNITY_EDITOR && !UNITY_WEBPLAYER
            if (Reloader != null)
            {
                Reloader.Stop();
                Reloader = null;
            }
                        #endif
        }
예제 #3
0
        /// <summary>Watches for changes if necessary.</summary>
        protected void Watch()
        {
                        #if UNITY_EDITOR && !UNITY_WEBPLAYER
            if (HtmlFile != null && WatchForChanges)
            {
                // Get the full asset path:
                string fullPath = UnityEditor.AssetDatabase.GetAssetPath(HtmlFile);

                // Create the loader:
                Reloader = new LiveHtml(fullPath,
                                        delegate(string path, string html){
                    // Write the innerHTML now:
                    Document.innerHTML = html;
                }
                                        );
            }
                        #endif
        }