It’s a matter of Condition triggering, whether it’s a condition or a triggerCondition in the form of a first trigger.
In my opinion, Visual Components does not set up the condition to be triggered by background data so that the simulation world is not bogged down by background data.
You can try to replace it with another evaluation method.
In fact, all you need to do is add a transmission signal for it to work properly.
from vcScript import *
comp = getComponent()
C_sig = comp.getBehaviour('ComponentSignal')
path = comp.getBehaviour('Path__HIDE__')
startStopSignal = comp.getBehaviour('ComponentPathSensor')
signal = comp.findBehaviour('TransitionSignal')
def OnSignal( signal ):
if signal.Name == 'ComponentSignal' and signal.Value:
signal.Value.stopMovement()
def OnRun():
while True:
if startStopSignal.Enabled:
triggerCondition(lambda: getTrigger() == C_sig and C_sig.Value)
condition(lambda : getTrigger() == signal and path.ComponentCount>=5)
#Add a trigger so that the condition can be triggered again.
print path.ComponentCount
C_sig.Value.startMovement()
But this is kind of a personal treatment for me, in fact, there are a lot of examples in VC’s eCatalog that use Condition (lambd: function()), you can refer to their examples to make it.
You can also reconfirm this through others in the forum who are knowledgeable on this point.