Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorAttachments
Behavior for element storing attached elements.
Provides list for ECBehaviorAttachToParent to register themselves at. This allows this behavior to manage attached elements in case of elements being added and removed from game worlds as well as finding specific attached elements. Does not support detaching elements. If the element is disposed all attached elements are disposed too. If you need dynamic attaching use ECBehaviorAttachSlot together with ECBehaviorAttachable.
This behavior can be used only once on an element.
Element class properties have the prefix attachments.
.
This behavior has no events.
This behavior requires no other behaviors.
This behavior does not support optional behaviors.
This behavior does not required element class to be persistable (setPersistable).
Since DragonScript Module Version 1.0
This example defines an element which can keep track of attached elements.
class MyElement extends BehaviorElementClass public var ECBehaviorAttachments attachments func new() attachments = ECBehaviorAttachments.new(this) end end
Using element class supporting adding behaviors the behavior can be added like this:
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <behavior type='ECBehaviorAttachments'> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.name'>value</string> </behavior> </elementClass>