Game Development Community

Behaviors and introspection

by Lance Hampton · in Torque Game Builder · 06/01/2009 (10:50 am) · 3 replies

I'm looking for a way to see what behaviors are currently installed on an object.

My current workaround is to set a variable on the object itself when I add a behavior, but I was wondering if there was a way to do this more directly.

#1
06/01/2009 (11:30 am)
I'm out of practice with t2d at the moment, but there should be a t2dSceneObject method along the lines of "findBehaviorByName", look around in the reference docs or do a dump.
#2
06/01/2009 (2:52 pm)
Awesome. It is in fact in the behaviorComponent class, which t2dsceneobject is derived from. I hadn't shaken the tree that far up.

Thanks.
#3
06/01/2009 (2:54 pm)
Oh, and it is:

getBehavior("behaviorName"); // works on any sceneobject

returns that objects instance of the behavior by that name.