Scripting

Musician is designed as a static facade entry point, consolidating all relevant subsystems (Player, Zoning, Tracking, Mood calculation).

Core responsibilities:

  • Managing the global MoodVector
  • Controlling music playback
  • Processing tracking influences
  • Initialization via Pitch
  • Event-based communication

Public Fields & Properties #

Core References #

public static Transform Target;
public static MusicianSettings Settings;
public static MusicianPlayer Player;
public static MusicianZoning Zoning;
  • Target: Target transform (e.g., player or camera) used for zoning and tracking.
  • Settings: Global configuration of the Musician system.
  • Player: Responsible for audio playback and track transitions.
  • Zoning: Handles mood zones in the scene.

Mood-Vectors #

public static MoodVector StaticMoodVector
public static MoodVector DynamicMoodVector
public static MoodVector TrackingMoodVector
public static MoodVector MoodVector
  • StaticMoodVector: Manually set base mood.
  • DynamicMoodVector: Temporary changes (e.g., events).
  • TrackingMoodVector: Automatically calculated mood from tracking.
  • MoodVector: Sum of all three vectors.

Balanced Mood Values #

public static float BalancedMoodX
public static float BalancedMoodY
public static float BalancedMoodZ
public static float BalancedMoodW
public static float BalancedMoodV

These values correspond to the individual mood axes, but are also slightly varied by a random offset from Settings.BalanceVector. This introduces a certain random factor into the music selection.


Tolerance #

public static MoodVector Tolerance

Accumulates all mood changes and serves as the basis for calculating tolerance intensity.


Events #

TrackEvent #

public static TrackEvent onNextTrack;

Triggered when a new track is played.

MoodEvent #

public static MoodEvent onMoodChanged;

Triggered as soon as the effective MoodVector changes.


Tracking #

AddTracking #

public static void AddTracking(ITracking tracking)

Registers a tracking object with the internal Tracker.

  • Automatically sets the tracker in the tracking object
  • Tracking affects the TrackingMoodVector

RemoveTracking #

public static void RemoveTracking(UnityEngine.Object target)

Removes a tracking object based on its Unity target.


Mood API #

Set single Mood-Axes #

SetMoodX(float value, bool notify = true)
SetMoodY(float value, bool notify = true)
SetMoodZ(float value, bool notify = true)
SetMoodW(float value, bool notify = true)
SetMoodV(float value, bool notify = true)
  • Values are limited to [0–1]
  • Update the StaticMoodVector
  • Increase the Tolerance
  • Optional event triggering

Set entire StaticMoodVector #

SetStaticMoodVector(MoodVector value, bool notify = true)

Sets all mood axes simultaneously.

  • Only performs an update if there is an actual change
  • Clamp to valid values

Dynamic mood changes #

PlusDynamicMoodVector(MoodVector value, bool notify = true)
MinusDynamicMoodVector(MoodVector value, bool notify = true)
  • Adds or subtracts temporary mood influences
  • Affects DynamicMoodVector
  • Updates Tolerance

➡️ Ideal for short-term events (combat, exploration, story beats)

Music & Player Interaction #

Change playlist #

ChangePlaylist(MusicianPlaylist playlist)

Changes the currently active playlist in the player.

Next Track #

NextTrack(Track track = null)
  • Plays the next track
  • Optionally starts a specific track

Pause / Resume #

PauseMusic(float fadeDuration = 1f)
ResumeMusic(float fadeDuration = 1f)
  • Smooth transitions using fade
  • Fade duration in seconds

Set ease type #

SetEaseType(Ease ease)

Sets the global ease type for transitions (e.g., crossfades).

What are your feelings

Updated on 15. Dezember 2025