{{tag>dragonscript behavior}} [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECABehaviorAnchorElement** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== ECABehaviorAnchorElement ====== Attachable behavior element behavior adding anchor element support. Anchoring elements allows to locate elements in a GameWorld using a unique name set by the mapper. This is useful for game commands send by conversations scripts. Since version 1.35 you can also use a group name. Using the group name the element is added to the named anchor group. This allows retrieving all elements sharing similar traits, for example triggers, typed pickups and so forth. The element can be anchored using unique name and group name at the same time. This behavior is similar to [[behavior_anchorelement|ECBehaviorAnchorElement]] but can be attached if required. This is especially useful in editing worlds to add an anchor to any element without needing to add \ref [[behavior_anchorelement|ECBehaviorAnchorElement]] to the element class itself. Upon adding behavior to element the element class properties mentioned below are evaluated if present ====== Instance Counts ====== This behavior can be used only once on an element. ====== Element Class Properties ====== Element class properties have no prefix. ===== anchorID ===== Sets the anchor name or empty string to not anchor. * Full name: "anchorID" * Type: string * Default Value: empty string ===== anchorGroupID ===== Sets the anchor group name or empty string to not anchor. * Full name: "anchorGroupID" * Type: string * Default Value: empty string ====== 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 require persistency. ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorAnchorElement.html,ECABehaviorAnchorElement~@#. Since DragonScript Module Version **1.31** ====== Use Cases ====== * Reference elements in world editor using unique the anchor name. * Allow game scripts to locate an element in the game world using the anchor name. ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]