-
Notifications
You must be signed in to change notification settings - Fork 0
Parameter compatibility
The rule that decides whether a listener written against an older version of a message still matches.
A listener may drop trailing arguments. A prefix must match by type.
After this send:
SendMessage(MSGKEY("ABC"), a, b, c); // TypeA, TypeB, TypeCall four of these listeners are compatible:
ListenMessage(MSGKEY("ABC"), this, [](TypeA a, TypeB b, TypeC c){});
ListenMessage(MSGKEY("ABC"), this, [](TypeA a, TypeB b){});
ListenMessage(MSGKEY("ABC"), this, [](TypeA a){});
ListenMessage(MSGKEY("ABC"), this, [](){});These are not:
ListenMessage(MSGKEY("ABC"), this, [](TypeB b){}); // wrong type at position 0
ListenMessage(MSGKEY("ABC"), this, [](TypeA a, TypeC c){}); // gap; position 1 must be TypeB
ListenMessage(MSGKEY("ABC"), this, [](TypeA, TypeB, TypeC, T4){}); // longer than the sendThe semantics mirror default function arguments — the listener sees a prefix of what was sent.

So a message can gain a parameter without a coordinated edit. Append to the end of the send and every existing listener keeps compiling and keeps working; only the listeners that want the new value are touched.
This is the migration path for a system whose whole point is that sender and listener do not share a header. Without it, adding one argument would mean finding every listener first.
- Order your parameters by stability. Things you might add later go at the end. A parameter inserted in the middle is a breaking change, and nothing will tell you at C++ compile time — the mismatch surfaces as a validation failure at runtime, in the editor.
- Removing or reordering is always breaking. Only appending is safe.
- A zero-argument listener matches everything on that tag. Useful for "something happened" handlers, and a trap if you meant to receive a value and mistyped the lambda.
The recorded signature lives in UGMPMeta. Comparison happens in the hub when a listener registers and
when a message is sent, under GMP_WITH_DYNAMIC_CALL_CHECK — on in Editor and Development, compiled out in
Shipping. A mismatch warns and aborts that dispatch rather than calling with wrong types.
Blueprint gets the same rule earlier: node pins come from the recorded signature, so an incompatible connection fails at Blueprint compile time. See UK2Neuron.
Signature inference · UGMPMeta · ListenMessage family · Class2Name
GMP · Reference wiki — one page per named thing. Guided introduction: project site · 中文站点 · measured dispatch stack Source: repository · README · README 中文
Pages here are generated from wiki/ in the main repository — edit there, not on the wiki.
Concepts
- Why a string key
- Dispatch layers
- Parameter compatibility
- Signature inference
- Key baking
- Transparent rewrite
- Jump tracing
Sending and listening
- NotifyMessage family
- ListenMessage family
- StoreObjectMessage
- MSGKEY
- FSigSource
- FSigHandle
- FGMPKey
- FGMPResponder
Dispatch internals
Reflection and data
Editor
Build