Game Object: controllers

controllers
  • Returns a list of the controllers attached to the game object.

Return Type:
  • list [ SCA_IController ]
controllers[ "controller_name"]
  • Returns a named controller attached to the game object.

Return Type:
  • SCA_IController
Sample Code

################## get a list of the controllers attached to the game object
 
# import bge
import bge

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

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

# get controller list
contList = obj.controllers

Sample Code

################## get a named controller attached to the game object
 
# import bge
import bge

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

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

# get controller named AND_3
cont = obj.controllers["AND_3"]