Common Oddity (solved)
by rennie moffat · in Torque Game Builder · 06/14/2011 (11:17 am) · 2 replies
Occasionally, like today I come across a very annoying thing. That thing is, sometimes a behavior, does not see an object declared in it's behaviorField.
ex.
game/scripts/behaviors/xxBehavior.cs (306): Unable to find object: 'thisObj' attempting to call function 'setFrame'
Thing is, i originally had the field for thisObj blank, in terms of, I declared the object in the editor, but also tried with it declared in script. So to sum it up, the object is seen as selected by the behavior in the editor, in fact it sets position as I ask it to, but will not set frame, stating that the behavior is unable to find object.I find this peculiar. IS there a common fix? Troubleshoot?
Thanks
ex.
game/scripts/behaviors/xxBehavior.cs (306): Unable to find object: 'thisObj' attempting to call function 'setFrame'
Thing is, i originally had the field for thisObj blank, in terms of, I declared the object in the editor, but also tried with it declared in script. So to sum it up, the object is seen as selected by the behavior in the editor, in fact it sets position as I ask it to, but will not set frame, stating that the behavior is unable to find object.I find this peculiar. IS there a common fix? Troubleshoot?
Thanks
About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#2
I think I found the reason. My call to setFrame was onLevelLoaded, not onBehaviorAdd and as such, it may have been calling before the behavior actually had time to find it.
06/15/2011 (9:35 am)
@Kevin, and all, thanks. I think I found the reason. My call to setFrame was onLevelLoaded, not onBehaviorAdd and as such, it may have been calling before the behavior actually had time to find it.
Torque Owner Kevin OFlaherty
Example
function BehaviorName::functionName(%this)
{
%this.owner.setFrame(3);
}
If this isn't what your asking or it didn't work you can get a faster response by emailing me. kevinoflaherty@makingindiegames.com