Events

Events facilitate communication between scripts. They work one-way, broadcast from broadcasters to receivers. Events come in two flavors, a non-generic version for basic event broadcasting, and a generic version for when data needs to be passed to receivers.

Note

Events are handled entirely in scripts. You can't configure them in Game Studio.

For example, this code creates two "Game Over" events. One with a non-generic and the other with a generic version of EventKey:

To receive the "Game Over" events described above, use:

  1. var gameIsOver = gameOverListener.TryReceive();
  2. {
  3. //data == "Player 1"
  4. }
  5. //Or in Async
  6. await gameOverListener.ReceiveAsync();