> For the complete documentation index, see [llms.txt](https://obvious-game.gitbook.io/soap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://obvious-game.gitbook.io/soap/scene-documentation/4_scriptableevents/event-listeners.md).

# Event Listeners

4\_ScriptableEvent

Health.cs is where those events are fired, but let’s find out who is listening to these events. Let’s check the prefab\_player and examine the DamageVFX.&#x20;

!\[Graphical user interface, text, application

Description automatically generated]\(<https://lh7-rt.googleusercontent.com/docsz/AD_4nXcS91kSU0iBGqNgeinmO-kh-bfmYiUDht1d-CdmTqnIP4aoBX02LhyJx4vVQSAXIDtqwwu598jiUvDfbHwk_dDujd5LifBFF8NjFlrxqN1k-mjYol4jIkrX9FmKkUFA-3Z0Oe-5n3elc0KztamAtPTa93A?key=npvPcHMgF_O4Om_5f5S8Bw)&#x20>;

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXe9yVhz2axEKkq8BoQcAm8gek1ce_NMB_43Z6KVLD2izL5rka4DSjBk6ExZfoHqVsfm82PWO_zcttsHnAFo1WbJqCU64ss7kh969X430LiH21ntGYkIkd6tX7wCTdWgxrvgc050mvAPcjZeHBvFYMFeQzk?key=npvPcHMgF_O4Om_5f5S8Bw)

When the player is damaged, this event is fired and it will trigger the particle system dynamic method “Emit” that takes an int as a parameter. With this simple trick, we can visually show a relation between the amount of damage and the intensity of the VFX without code. A damage of 10 will emit 10 particles, and a damage of 50 , maybe a critical hit, will emit 50 particles.  &#x20;

In  a bigger game, you would probably have a different VFX for different amounts of damage, but in Hyper Casual games, you can get away with this. The Heal VFX in the prefab\_player does the opposite but works the same way.&#x20;

You may have noticed that when the player gets damaged, there is a red vignette effect appearing then fading out. &#x20;

UICanvas/Damage Vignette&#x20;

!\[Text

Description automatically generated]\(<https://lh7-rt.googleusercontent.com/docsz/AD_4nXefdZ4Tpo3MbS2yr3CBxOldh_aJCOVhfHPJNqfLnbJvc_X2B81-SjRbM6x81Oc5TGjrtdOGF04Ci3rGcVojgkP8wiBo967DHpOpYw0c3d-UEOYF4sr2iPvyQPc61rEWneRd0AxQlMJGWubyS_Cv-LmaJwc2?key=npvPcHMgF_O4Om_5f5S8Bw>)

&#x20;

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdz9jLVQ7jtenqKgMJlFC74kqgE4fJKq4jSB33KlalDz7V_Nwocc_0BUjlTS_jG9Nczq7AHyK45uy4tZXZ9nAd8rSsw2WZj5XUtFrU_KXBwa7fhBrFL3sPeO-im4RW7r4pXf0nEC4wrf6_nDyhuDM2cocS3?key=npvPcHMgF_O4Om_5f5S8Bw)

As we can see, here we listen to the OnPlayerDamaged event. When it is fired, we activate the Fade out. &#x20;

Note : we ignore the int parameter as we don’t need it and call a regular method instead of a dynamic method through the unity event. &#x20;

The example\_OnPlayerDeath event is listed by the Game Over screen. &#x20;

You will notice that the Game Over Screen is visible in the editor and gets disabled when the game starts. Indeed,  it needs to be enabled to register to the event at the beginning of the game. &#x20;

This is what the boolean variable  called “Disable after subscribing” is for. The purpose of this variable is to disable the GameObject after subscribing to the event in Awake(). &#x20;

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXePR9ME82YduBxid848mPEB9jZO1bWzqAyl6BMUuSI0ApVzThWs6MVUKGIiiFZZGrUivsvcH9j_u5qa5UjUL0UWAgQilrX7lBzawOZ6gHFlenX2azg1MJt0hfY5HeDhSrb6LLsNipL_MzkR1nfAq8rCR6_0?key=npvPcHMgF_O4Om_5f5S8Bw)

You will notice also that we added a small delay before invoking the response. This is useful to add small delays without needing to write code to do it.&#x20;
