Events.ObjectCreatedCallback cannot detect IPlayer
Posted: Fri Mar 25, 2022 6:11 pm
I cannot use Events.ObjectCreatedCallback to detect whether a new player is spawned. Minimal code example:
By the way, I'd want to have a separate event to detect if a new player is spawned since I am not interested in listening to hundreds of other objects. Something like:
Code: Select all
Events.ObjectCreatedCallback.Start(os =>
{
foreach (var o in os)
{
if (o is IPlayer)
{
Game.WriteToConsole(o.Name);
}
}
});
Code: Select all
Events.PlayerCreatedCallback.Start((IPlayer[] players) => { /* ... */ });