You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A common pattern I've dropped into when making systems is listening and checking for multiple components being added. An example of this is an animation system, which requires access to the AI and Rig components of an entity. To do this right now, you have to listen to the addition of all components you need to reason with, then check that all components exist in a component added method.
functionAnimationSystem:onDependencyAdded(instance)
localrig=self.core:getComponent(instance, RecsComponents.Rig)
localai=self.core:getComponent(instance, RecsComponents.AI)
ifrigandaithen-- do stuffendendfunctionAnimationSystem:init()
forinstanceinself.core:components(RecsComponents.Rig, RecsComponents.AI) doself:onDependencyAdded(instance)
endself.core:getComponentAddedSignal(RecsComponents.Rig):connect(function(instance)
self:onDependencyAdded(instance)
end)
self.core:getComponentAddedSignal(RecsComponents.AI):connect(function(instance)
self:onDependencyAdded(instance)
end)
end
Some equivalent to getComponentAddedSignal(identifier) that accepts multiple identifiers and only fires when all exist would clean this pattern up.
The text was updated successfully, but these errors were encountered:
A common pattern I've dropped into when making systems is listening and checking for multiple components being added. An example of this is an animation system, which requires access to the AI and Rig components of an entity. To do this right now, you have to listen to the addition of all components you need to reason with, then check that all components exist in a component added method.
Some equivalent to
getComponentAddedSignal(identifier)
that accepts multiple identifiers and only fires when all exist would clean this pattern up.The text was updated successfully, but these errors were encountered: