Game Development Community

Value interfaces, not null upon registering component?

by Darthuvius · in Torque X 2D · 04/08/2010 (2:56 pm) · 0 replies

Hi,

I am having a problem with my value interfaces. I'm spawning a bunch of orcs who each have a playerchase and pathfollowing component attached to them. I have a chasing interface on the playerchase component which is set to false by default.

The pathfollowing OnRegister method has this line,
_startchasing = Owner.Components.GetInterface<ValueInterface<bool>>("bool", "startchasing");

My question is, should the value of _startchasing always be null before its called in the pathfollowing component? Sometimes it is not null, which is my problem.

I'm not sure I understand interfaces, but I was hoping that they were object specific. The _startchasing value seems to be carrying over to newly spawned orcs, especially If I destroy one right before another one spawns. Am I missing something or what?


Update:
I have been clicking the pool with components checkbox for my enemies after reading this in the blaster tutorial,

"Since we'll eventually be creating and destroying lots of instances of these enemies, it's a good idea to click on "Pool With Components" box, too, since this will let Torque X be more efficient about reusing memory from destroyed objects."

But I decided to uncheck this box and my orcs are now behaving correctly. Clicking the pool box also causes interface values to jump objects.