public void DrawNodeTree(UnityNodeBase rootNode)
        {
                        #if UNITY_EDITOR
            EditorApplication.ExecuteMenuItem("AssetSerializer/Node Graph");
            this.nodeWindow = EditorWindow.focusedWindow;

            DebugTree(rootNode);
                        #endif
        }
        private static void ImportAsset(string filePath)
        {
            System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            timer.Start();

            IFileHandle fileHandle = new NormalFileHandle(filePath);
            PCFFile     file       = new PCFFile(fileHandle, false);

            file.LoadFile(PCFResourceType.ALL, false);

            Dictionary <PCFResourceType, DataBlockBase> dataBlocks = file.GetDataBlocks();

            UnityNodeBase rootNode = null;

            //Deserialize and create main asset.
            rootNode = UnityRootNode.CreateNodeTree(dataBlocks, fileHandle, new NodeFactory(null));

            NodeBlockDebugging debugger = new NodeBlockDebugging();

            debugger.DrawNodeTree(rootNode);

            if (rootNode != null)
            {
                List <Action <UnityNodeBase> > postInstallActions = new List <Action <UnityNodeBase> >();

                //Start rebuilding the asset, starting with the root node.
                rootNode.Deserialize(dataBlocks, null, null, postInstallActions, true);

                for (int i = 0; i < postInstallActions.Count; i++)
                {
                    //Some nodes deserialize themselfves as a post process because they depend on other stuff being created/deserialized first.
                    postInstallActions[i](rootNode);
                }
            }

            //Unload pcf file data, clear everything out. No longer needed.
            file.Unload();

            rootNode.InstantiateContent();

            timer.Stop();
            UnityEngine.Debug.Log("total: " + timer.ElapsedMilliseconds);
        }
        void DebugTree(UnityNodeBase node)
        {
                        #if UNITY_EDITOR
            if (node != null)
            {
                JObject jsonNode = node.GetJSONRepresentation();

                Event e = EditorGUIUtility.CommandEvent(jsonNode.ToString());
                this.nodeWindow.SendEvent(e);

                if (node.ChildNodes != null)
                {
                    for (int i = 0; i < node.ChildNodes.Count; i++)
                    {
                        UnityNodeBase child = node.ChildNodes[i];

                        DebugTree(child);
                    }
                }
            }
                        #endif
        }