Method TryGetEvent
TryGetEvent<TEvent>(out TEvent?)
Attempts to get the current running event.
public bool TryGetEvent<TEvent>(out TEvent? eventData) where TEvent : IEvent, new()
Parameters
eventDataTEventWhen this method returns, contains the created event if the current event is a TEvent. Otherwise, returns the default value for TEvent.
Returns
- bool
true if the current running script is a TEvent, otherwise false.
Type Parameters
TEventThe expected event type. Only events attributed with Anvil.API.Events.GameEventAttribute are supported.