---
title: "Game Events - s&box library"
description: "Strongly typed game events"
canonical: "https://sbox.watch/ru/libraries/facepunch/libevents/"
generated_at: "2026-10-09T12:59:14.901Z"
---

# Game Events

Strongly typed game events

- Тип: библиотека
- Идентификатор: facepunch.libevents
- Автор: Facepunch
- Канонический URL: https://sbox.watch/ru/libraries/facepunch/libevents/
- Markdown: https://sbox.watch/ru/libraries/facepunch/libevents/index.md
- sbox.game: https://sbox.game/facepunch/libevents/
- Создано: 2026-10-09T12:59:14.901Z

## Статистика

- динамика за 24 ч: +0
- Terry Score: 83%
- Избранное: 15
- Положительные оценки: 13
- Отрицательные оценки: 0
- Обновлено: 11 авг. 2024 г.
- Создано: 11 июн. 2024 г.
- Размер: 156.8 KB
- Файлы: 19
- Теги: event, events, fsm

## Описание

About Game Events

Easily dispatch events in your scene when stuff happens.

Basics

Declare an event type implementing with all the properties you want to pass around.

public record DamagedEvent(
 GameObject Attacker,
 GameObject Victim,
 int Damage ) : IGameEvent;

Implement for your custom event type in a .

public sealed class MyComponent : Component,
 IGameEventHandler<DamagedEvent>
{
 public void OnGameEvent( DamagedEvent eventArgs )
 {
 Log.Info( $"{eventArgs.Victim.Name} says \\"Ouch!\\"" );
 }
}

Dispatch the event on a or the , which will notify any components in its descendants.

GameObject.Dispatch( new DamagedEvent( attacker, victim, 50 ) );

Invocation order

You can control the order that handlers are invoked using attributes on the handler method.

\* : run this first
\* : run this last
\* : run this before 's handler
\* : run this after 's handler

\[Early, After<SomeOtherComponent>\]
public void OnGameEvent( DamagedEvent eventArgs )
{
 Log.Info( $"{eventArgs.Victim.Name} says \\"Ouch!\\"" );
}




## More by Facepunch

| Package | Идентификатор | Игроки | Избранное | Положительные оценки | Оценка | Markdown |
| --- | --- | --- | --- | --- | --- | --- |
| Player Controller | facepunch.playercontroller | 0 | 98 | 74 | 96% | https://sbox.watch/ru/libraries/facepunch/playercontroller/index.md |
| SDF Mesh Library | facepunch.libsdf | 0 | 30 | 25 | 90% | https://sbox.watch/ru/libraries/facepunch/libsdf/index.md |
| Sprite Tools (OBSOLETE) | facepunch.spritetools | 0 | 18 | 22 | 83% | https://sbox.watch/ru/libraries/facepunch/spritetools/index.md |
| State Machines | facepunch.libstates | 0 | 13 | 17 | 86% | https://sbox.watch/ru/libraries/facepunch/libstates/index.md |
| Spline Tools | facepunch.splinetools | 0 | 12 | 17 | 86% | https://sbox.watch/ru/libraries/facepunch/splinetools/index.md |
| Movie Maker (Preview) | facepunch.moviemaker | 0 | 8 | 13 | 74% | https://sbox.watch/ru/libraries/facepunch/moviemaker/index.md |
