MessageBusSubscriber Subcribe T  Method DH.Messaging Documentation

[This is preliminary documentation and is subject to change.]

Subscribe to messages with the given message key and type

Namespace: (Default Namespace)
Assembly: DH.Messaging.Extensions (in DH.Messaging.Extensions.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax

public void Subcribe<T>(
	string messageKey
)

Parameters

messageKey
Type: OnlineSystem String
Unique message identification key
Type Parameters

T
The type of message expected
Remarks

If a subscription for the specified type already exists it will be used, if not, then it will automatically be created.
Examples

Example of subscribing to a Vector3 message with a key of "PointOfInterest"
var subscriber = gameObject.CreateSubscriber();
subscriber.Subscribe<Vector3>("PointOfInterest");

Using this type of example you could, for instance, make a crowd of characters react to an explosion but sending a message of type Vector3 and a key of "PointOfInterest" to the MessageBusManager and receiving it with all characters that are subscribed.

See Also