Hello,
long story short, how can i add/remove entities from a system ?
in my multiplayer prototype i have 2 gameObject holding 2 camera.
When Player 2 enter the game, i need a system that disable Player 1’s on Player’s 2 Client. (and vise versa)
but how can i get a system to do it only once ? i dont want it to disable things every frame in the OnUpdate method.
Also, for the moment i use that to filter what entity my Moving system should act on
protected override void OnUpdate()
{
foreach (var entity in GetEntities<Group>())
{
if (entity.networkIdentity.isLocalPlayer)
{
Move(entity)
}
}
}
But that mean my script look through every entity each frame to look at isLocalPlayer. wouldn’t it be better to remove !isLocalPlayer from the system ?