SimObject referencing
by Richard Andersson · in Torque Game Engine · 06/13/2007 (6:52 am) · 2 replies
Just a quick question. When am I supposed to use the SimObject referencing tools (registerReference/unregisterReference) and SimObjectPtr? What happens if i don't register my references? Could it create problems? From what I can tell, not much should happen but maybe I am missing something.
#2
That's probably not what's causing my problems though... I'll start another thread.
06/14/2007 (2:10 am)
I see. That's pretty cool, I should start using those :)That's probably not what's causing my problems though... I'll start another thread.
Torque 3D Owner Stephen Zepp
The main benefit is that if the object you are referencing is deleted normally, all SimObjectPtrs will be "magically" made null. If you follow good programming practice and always check your pointers validity (myPtr != null), then you will never have a stale reference.
Register/Unregister reference is the same concept, but requires a bit more coding, and is for a more generic case. It's not used too often for most games.