# IPauseReceiver

You can implement a method to call when the graph is paused.

## About pausing the graph

- Pause with the `Pause()` method of `LogicToolkit.LogicPlayerBase`.
- Resume with the `Resume()` method of `LogicToolkit.LogicPlayerBase`.
- Pausing is also performed in conjunction with the `isActiveAndEnabled` property of `LogicToolkit.LogicPlayerBase`.

## How to write a script

- Implement `LogicToolkit.IPauseReceiver` in types that inherit from various NodeComponents.
- Implement `public void OnPause(bool pause)`.

## Code example

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using LogicToolkit;

    [System.Serializable]
    public class PauseExample : ServiceComponent, IPauseReceiver
    {
        private Animator animator;

        // OnActivated is called when activated.
        protected override void OnActivated()
        {
            animator = Player.GetComponent<Animator>();
        }

        public void OnPause(bool pause)
        {
            if (pause)
            {
                animator.speed = 0f;
            }
            else
            {
                animator.speed = 1f;
            }
        }
    }

In this example, when using this component, such as in a Service node, the Animator will pause in conjunction with the pose of the graph.