# How to Listen to Graph Events

States and transitions provide some events which are invoked when they are entered or exited. To add listeners to these events in the editor simply select the state or transition in the State Machine Graph and edit the OnEnterState, OnExitState or OnEnterTransition, OnExit Transition fields respectively. If you want to add listeners from script, check out the [Listening to Events from Script ](https://ilumisoft.gitbook.io/visual-state-machine/advanced/listening-to-events-from-script)and [Writing Custom State Behaviours](https://ilumisoft.gitbook.io/visual-state-machine/advanced/writing-custom-state-behaviours) section.

<figure><img src="https://3979764177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MCgKLjperRFhHlR4O0p%2Fuploads%2FYsBXkrQL00fuuWO4dXmv%2Fimage.png?alt=media&#x26;token=71da9a73-f2f9-4626-b749-e4985b35e689" alt=""><figcaption></figcaption></figure>
