Attach on Event LPK_AttachOnEvent.cs

This component causes an object to be attached (parented) to another upon receiving a specified event. It will not be un-parented until Detach on Event is used.

If the event received is sent to and received by multiple objects, the child will only be parented to one of them, which will alter the behavior of the child accordingly. To mitigate this happening, set the event sending mode wisely.

Suggested use:

Use another component to send the event that will trigger an object being parented to another object. You can additionally send an event when the objects are "attached" to each other.

Caveats:

Examples found in: Project 4

Components
Property Type Description Default Value
Component Properties
If child and parent objects and tags are left empty, the game will break, because the owner cannot be the parent and the child simultaneously.
Parent Game Object Parent game object to attach the child to. If this and parent tag are empty, the owner will be the parent. None
Parent Tag Tag Tag of the parent object to attach the child to. If this and parent object are empty, the owner will be the parent. Untagged
Child Game Object Child to attach to the parent. If this and child tag are empty, the owner will be the child. None
Child Tag Tag Tag of the child object to attach to the parent. If this and child object are empty, the owner will be the child. Untagged
Event Receiving Info
Event Trigger LPK Event Object Which event will trigger this component's action. None
Attach Event Sending Info
Event LPK Event Object Event to dispatch when attach conditions are met:
  • When the Event Trigger is received, and the Child object is attached to the Parent object.
None
Event Sending Mode LPK Event Sending Mode Who receives the event sent info when input is given from the input device. OWNER = only send to components on the same game object. ALL = send to all game objects. TAGS = send to specified tags. TAGS
Event Sending Mode - TAGS
Tags Array of Tags Which tags will receive this event. 0
Debug Properties
Print Debug Info Boolean Toggle console debug messages. False
Label String Notes for the user about this component. This does nothing to the game or build. None