The game mood can be directly linked to any game values. This allows the music or atmosphere to react dynamically to the current game status.
The following example demonstrates how the player experience (health) is linked to the mood system.
Example: Tracking Player Health #
var healthTracking = new Tracking<float>(
this,
() => health,
new Vector2(0, 100),
new MoodVector(3f, 3f, 3f, 3f, 0),
invert: true
);
Musician.Runtime.Musician.AddTracking(healthTracking);
Explanation of the individual code components #
new Tracking<float>(...) #
Creates a new tracking object for a value of type float.
this #
The owner of the tracking.
- Usually a
MonoBehaviour - Used to automatically remove tracking when the object is destroyed
() => health #
() => healthA getter (lambda function) that returns the current value.
- Queried regularly by the system
- Can return any variable or calculation
Example:
() => currentHealth
new Vector2(0, 100) #
new Vector2(0, 100)The value range within which the tracked value fluctuates.
x→ Minimum valuey→ Maximum value
This range is used to normalize the current value.
Example:
- 0 = empty
- 100 = full
new MoodVector(3f, 3f, 3f, 3f, 0) #
new MoodVector(3f, 3f, 3f, 3f, 0)Defines how strongly this value influences the individual mood axes.
👉 The higher the value, the stronger the influence on the musical mood
invert: true #
invert: trueInverts the influence of the value.
- false (default): high value → strong mood influence
- true: low value → strong mood influence
In the health example, this means:
- High health → relaxed mood
- Low health → tense/dangerous mood
Musician.Runtime.Musician.AddTracking(...)
Registers tracking with the global music/mood system.
⚠️ Important:
- Without this call, nothing happens
- Tracking will now be evaluated automatically
What do I need to do to track my own values? #
- Define a value (e.g., health, stamina, hunger, danger)
- Set an appropriate value range
- Decide how strongly the value influences the mood
- Optional: activate
invert - Register tracking with
Musician
Typical use cases #
- Gaming experience
- Time pressure
- Resource scarcity
- Quest statuses

