Game Development Community

Check existence of behavior

by Kevin James · in Torque Game Builder · 05/12/2010 (12:11 pm) · 3 replies

I did search for this but came up empty. How do I check in code if a behavior exists?

%object.addBehavior(GenericButtonBehavior.createInstance());
...

  if (%Object.Behavior[0]) ?

About the author

Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/


#1
05/12/2010 (12:40 pm)
Since all I need to know if there is any behavior, this works:
if (%object.getBehaviorCount()){
#2
05/12/2010 (1:00 pm)
From script: getBehavior("BehaviorName")
#3
05/12/2010 (3:13 pm)
Ahhh perfect!