Class ChannelKey
A ScriptableObject asset used as an identity token to scope event-bus publications and subscriptions to a specific named channel.
[CreateAssetMenu(menuName = "ScriptableObject/Channel Key", fileName = "NewChannelKey")]
public sealed class ChannelKey : ScriptableObject
Inheritance
Examples
// Assign the same ChannelKey asset to both the publisher and subscriber
// to ensure messages only cross between those two systems:
[SerializeField] private ChannelKey actorChannel;
// Publisher:
aggregator.Publish(new BatteryMessage(level), actorChannel);
// Subscriber (subscribes only on actorChannel):
aggregator.Subscribe(this, actorChannel);
Remarks
Using a ScriptableObject instance as a channel key rather than a string or enum has a critical advantage: identity is based on object reference, not value. Two assets with the same Description text are still separate keys, so accidental channel collisions between independently authored systems are impossible. It also means the channel is serialisable as an asset drag-and-drop in the Inspector, eliminating magic-string bugs.
The typical pattern is to create one ChannelKey asset per actor (or per logical
group), assign it to both the publisher (e.g., BatterySystem)
and all matching subscribers (e.g., the actor's battery UI). Leave the key null for
global, scene-wide events that any subscriber may receive regardless of which actor produced them.