Game Development Community

setEnabled(), couple of questions

by rennie moffat · in iTorque 2D · 07/28/2010 (10:06 pm) · 4 replies

Hi All,
I am attempting to use setEnabled() as a way of saving memory. I have set up a trigger, which works fine if I use setPause in place of setEnabled, so all the code leading up to the commands work fine, however, when I use setEnabled, my object, never appears. It remains invisible.


So, I am wondering 2 things.
1. is setEnabled reliable? I have read some threads where others are also having some trouble with it, but nothing definitive.
2. is setEnabled going to save me much more computing power than setPaused? if so, how much?

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.


#1
07/28/2010 (10:10 pm)
Rennie, I use setEnabled a lot to "hide" objects that are in the pool and not active - I call setEnabled(false) and this stops the object from participating in the scene graph calculations.
#2
07/28/2010 (10:55 pm)
ok, so I want them to be invisible to the computer, so I have stress levels to the machine.

So, in theory it should work...


setEnabled(false)
// object is invisible and behavior is not processed(?)

setEnabled(true)
/// object is as normal, fully functioning



Is this correct?
#3
07/29/2010 (7:45 am)
Can't speak for behaviors but certainly for render processing that is correct, I suspect it will work.
#4
07/29/2010 (9:40 am)
ok, so I figured it out.


setPaused(), worked completely fine on it's own, object paused or not, simple.


setEnabled(), when triggered true, object appears, but was paused, so I have had to use when enabled, also unpause and vice versa, works great.