Example #1
0
        public void Destroy()
        {
            foreach (Component comp in components)
            {
                comp.Destroy();
            }
            components.Clear();

            List <GameObject> copyChildren = new List <GameObject>(children.Values);

            foreach (GameObject child in copyChildren)
            {
                child.Destroy();
            }
            children.Clear();

            Scene.RemoveObject(this);

            Parent = null;
        }