getChild() public method

returns the Transform child at index
public getChild ( int index ) : Transform
index int Index.
return Transform
Example #1
0
        /// <summary>
        /// removes the Entity from the scene and destroys all children
        /// </summary>
        public void destroy()
        {
            _isDestroyed = true;
            scene.entities.remove(this);
            transform.parent = null;

            // destroy any children we have
            for (var i = transform.childCount - 1; i >= 0; i--)
            {
                var child = transform.getChild(i);
                child.entity.destroy();
            }
        }
Example #2
0
        /// <summary>
        /// removes the Entity from the scene and removes all Components and Colliders
        /// </summary>
        public void destroy()
        {
            scene.entities.remove(this);

            // destroy any children we have
            for (var i = 0; i < transform.childCount; i++)
            {
                var child = transform.getChild(i);
                child.entity.destroy();
            }

            transform.parent = null;

            // remove all our components when we are destroyed
            components.removeAllComponents();
            colliders.removeAllColliders();
        }