From Intrigues Wiki

onTargetChanged Event in Scheme Class


The onTargetChanged event in the Scheme class is triggered when there is a change in the target actor of a scheme. This event allows the game to dynamically respond to alterations in the scheme's target.

Event Definition

public static event Action<Scheme, Actor> onTargetChanged;


  • Parameters:
    • Scheme: The scheme for which the target has changed.
    • Actor: The new target actor of the scheme.
  • Type: Action<Scheme, Actor> - A delegate type that defines the method signature for event handlers.
  • Visibility: Public.


  • This event provides a mechanism to notify other components of the game when the target of a scheme is updated. This is crucial in games where the progression of schemes significantly impacts gameplay or narrative.
  • It can be used to update UI elements, modify game logic, or trigger specific actions in response to changes in a scheme's target.


The onTargetChanged event is instrumental in systems that require tracking of scheme targets, such as updating the display of scheme information in the UI or adjusting game mechanics based on the new target.

Example of Usage

public class SchemeTargetListener : MonoBehaviour {
    void OnEnable() {
        Scheme.onTargetChanged += HandleTargetChange;

    void OnDisable() {
        Scheme.onTargetChanged -= HandleTargetChange;

    private void HandleTargetChange(Scheme scheme, Actor newTarget) {
        Debug.Log($"Target of scheme '{scheme.SchemeName}' changed to: {newTarget.Name}");


  • The example shows a class subscribing to the onTargetChanged event. When the target of any scheme changes, the HandleTargetChange method logs the new target of the scheme.
  • The subscription is set up in OnEnable and removed in OnDisable to manage the event lifecycle properly.


  • Handling the onTargetChanged event is crucial for games with dynamic scheme systems, where targets can change due to various gameplay events or player decisions.
  • Proper management of event subscriptions is necessary to prevent memory leaks and ensure that changes in targets are accurately reflected throughout the game.
  • Event handlers for onTargetChanged should be carefully managed to avoid memory leaks or unintended behavior, especially when subscribing and unsubscribing from the event.