/// <summary>
 /// constructor taking a serializable node
 /// </summary>
 public Node(SerializableNode sn)
 {
     GameObject  = sn.GameObject;
     HasMesh     = sn.HasMesh;
     P0          = sn.P0;
     R0          = sn.R0;
     S0          = sn.S0;
     Bounds      = sn.Bounds;
     Material    = sn.Material;
     Locked      = sn.Locked;
     Name        = sn.Name;
     GOName      = sn.GOName;
     Description = sn.Description;
 }
 /// <summary>
 /// constructor taking a serializable node
 /// </summary>
 public Node(SerializableNode sn)
 {
     //Childs = children,
     GameObject = sn.GameObject;
     HasMesh    = sn.HasMesh;
     //Parent = null,
     P0       = sn.P0;
     R0       = sn.R0;
     S0       = sn.S0;
     Bounds   = sn.Bounds;
     Material = sn.Material;
     Locked   = sn.Locked;
     Name     = sn.Name;
     GOName   = sn.GOName;
 }
        /// <summary>
        /// add serialized nodes into the list of serialized nodes
        /// </summary>
        void AddNodesToSerializedNodesBFS()
        {
            if (Root == null)
            {
                return;
            }

            List <Node> toProcess = new List <Node>();

            toProcess.Add(Root);

            var serializedRoot = new SerializableNode()
            {
                ChildCount        = Root.Childs.Count,
                IndexOfFirstChild = 1,
                GameObject        = Root.GameObject,
                HasMesh           = Root.HasMesh,
                indexOfParent     = -1,
                P0       = Root.P0,
                R0       = Root.R0,
                S0       = Root.S0,
                Bounds   = Root.Bounds,
                Material = Root.Material,
                Locked   = Root.Locked,
                Name     = Root.Name,
                GOName   = Root.GOName
            };

            serializedNodes.Add(serializedRoot);

            int parentId = 0;

            while (toProcess.Count > 0)
            {
                Node n        = toProcess[0];
                int  nCousins = 0;
                int  childid  = 0;
                foreach (var child in n.Childs)
                {
                    var serializedNode = new SerializableNode()
                    {
                        ChildCount        = child.Childs.Count,
                        IndexOfFirstChild = serializedNodes.Count + n.Childs.Count - childid + nCousins,
                        GameObject        = child.GameObject,
                        HasMesh           = child.HasMesh,
                        indexOfParent     = parentId,
                        P0       = child.P0,
                        R0       = child.R0,
                        S0       = child.S0,
                        Bounds   = child.Bounds,
                        Material = child.Material,
                        Locked   = child.Locked,
                        Name     = child.Name,
                        GOName   = child.GOName
                    };
                    serializedNodes.Add(serializedNode);
                    nCousins += child.Childs.Count;
                    childid++;
                    toProcess.Add(child);
                }

                toProcess.RemoveAt(0);
                parentId++;
            }
        }