Game Object: childrenRecursive

childrenRecursive
  • Returns a list of the children and children of the children.

Return Type:
  • list [ KX_GameObject ]
Sample Code

################## get a list of the object's children and 'grandchildren'
    
# import bge
import bge

# get controller
cont = bge.logic.getCurrentController()

# get object that controller is attached to
obj = cont.owner

# get a list of the children and 'grandchildren' game objects
childList = obj.childrenRecursive