System that have to run once

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 ?

Systems only run if there are entities who matches the ComponentGroup of a system…
So you can work with tags on entities or with event entities

i’m not sure to understand. how can i put tags checks in my private struct group ?
also i never heard of event entities either…

currently my private struct look like this

    private struct Group
    {
        public Transform transform;

        public NetworkIdentity networkIdentity;

        public PlayerInput playerInput;
        public PlayerCameraVariablesComponent variables;

    }

i cant disable player input nor variables and i dont think disabling transform or networkidentity will do any good.