{{tag>dragonscript behavior}} [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorAttachments** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== ECBehaviorAttachments ====== Behavior for element storing attached elements. Provides list for [[behavior_attachtoparent|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 [[behavior_attachslot|ECBehaviorAttachSlot]] together with ECBehaviorAttachable. ====== Instance Counts ====== This behavior can be used only once on an element. ====== Element Class Properties ====== Element class properties have the prefix ''attachments.'' . ====== Events ====== This behavior has no events. ====== Required Behaviors ====== This behavior requires no other behaviors. ====== Optional Behaviors ====== This behavior does not support optional behaviors. ====== Persistency ====== This behavior does not required element class to be persistable (setPersistable). ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorAttachments.html,ECBehaviorAttachments~@#. Since DragonScript Module Version ''1.0'' ====== Use Cases ====== * Keep track of elements attached to actor. * Allow moving element together with attached elements to another game world. ====== Element Class Example ====== 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 ====== Behavior Factory ====== Using element class supporting adding behaviors the behavior can be added like this: value ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]