Class SubscriberBehaviour<T>
Abstract MonoBehaviour base for components that subscribe to T messages.
Inherited Members
Object.GetEntityId()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Namespace: Unity.SimulationPro.Foundation
Assembly: Unity.SimulationPro.Foundation.dll
Syntax
public abstract class SubscriberBehaviour<T> : MonoBehaviour where T : IMessage
Type Parameters
| Name | Description |
|---|---|
| T | The IMessage type this component subscribes to. |
Remarks
In Start() this component calls FindConnector(Component)
to locate the active IConnector and registers the Callback for
the configured Topic. If no connector is found, a warning is logged and no
subscription is made.
Properties
Callback
Gets the callback invoked each time a message is received on the subscribed topic.
Declaration
protected abstract Action<T> Callback { get; }
Property Value
| Type | Description |
|---|---|
| Action<T> |
Connector
Gets or sets the active IConnector used by this subscriber.
Available after Start() has run and a connector was found.
Declaration
protected IConnector Connector { get; set; }
Property Value
| Type | Description |
|---|---|
| IConnector |
DefaultTopic
Gets the default topic name used when Topic has not been set.
Declaration
public virtual string DefaultTopic { get; }
Property Value
| Type | Description |
|---|---|
| string |
Topic
Gets or sets the topic name this component subscribes to. Defaults to DefaultTopic if not set.
Declaration
public string Topic { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Start()
Start.
Declaration
protected virtual void Start()