From Intrigues Wiki

onSchemeEnded Event in Actor Class


The onSchemeEnded event is a critical component of the Actor class, triggered upon the conclusion of a scheme. It's instrumental in games where the outcomes of schemes drive narrative developments, character interactions, or gameplay changes.

Description of SchemeResult Enum

  • Enum Type: SchemeResult
  • Values:
    • None: Indicates no specific result.
    • Success: Represents a successful completion of the scheme.
    • Failed: Signifies that the scheme did not achieve its intended outcome.

Description of onSchemeEnded Event

  • Event Type: Action<Scheme, SchemeResult>
  • Functionality: Activates when a scheme involving the actor ends, providing insights into both the scheme and its outcome. The event handler receives the scheme that ended and its result as defined by the SchemeResult enum. This setup allows for tailored reactions based on the nature and success or failure of the scheme.


The event is used to trigger specific actions or logic in response to the conclusion of schemes, such as updating game states, adjusting character statuses, or advancing the storyline based on the scheme's result.

Subscribing to the Event

Subscribe to the onSchemeEnded event within a MonoBehaviour script to handle the end of schemes. Ensure to unsubscribe from the event appropriately to maintain optimal performance and prevent memory leaks.

Example of Usage

public class SchemeOutcomeHandler : MonoBehaviour {
    public Actor actor;

    void Start() {
        if (actor != null) {
            actor.onSchemeEnded += OnSchemeEnded;

    private void OnSchemeEnded(Scheme scheme, SchemeResult result) {
        Debug.Log($"Scheme {scheme.SchemeName} ended with result: {result}");
        // Custom logic based on the scheme's outcome

    void OnDestroy() {
        if (actor != null) {
            actor.onSchemeEnded -= OnSchemeEnded;

In this Unity script example, the SchemeOutcomeHandler is attached to a GameObject and listens for the onSchemeEnded event from an Actor. When a scheme ends, it triggers the OnSchemeEnded method, allowing for responses tailored to the specific outcome of the scheme.


  • The onSchemeEnded event with SchemeResult allows for nuanced and strategic gameplay, enhancing player engagement through responsive and outcome-based scenarios.
  • Understanding and utilizing the different outcomes in SchemeResult is key to creating a dynamic and interactive game environment.
  • This event is particularly crucial in narrative-rich and strategy-focused games where the consequences of player actions significantly impact the game's progression.