Destroying a Directobject

I’ve setup a class based on DirectObject just to organize all my input controls. It checks what “mode” my game is in (menu, playing, editor) and does various accepts based on this.

It works without a problem.

However, I would like to make sure I’m cleaning this object up properly as I destroy it when I switch “mode” in my game.

I switch modes like this (myControls is the class based on DirectObject):

	def setGameControls(self):
		if hasattr(self, 'Controls'): 
			self.Controls.destroy()
			del self.Controls

		self.Controls = myControls(self.GAME_MODE)

Mycontrols has this destroy method:

	def destroy(self):
		self.ignoreAll()

Should I do more to cleanup this object?

That is the correct way to clean up a DirectObject.

David