i'm afraid this may lead to lag of performance
This is called premature optimization. You are worrying about performance but you have done nothing to actually test whether this fear is justified. Now you are considering taking action to correct a problem that you have not verified actually exists.
How can we test? Let's consider a very simple program :
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace ConsoleApp3
{
class Program
{
class Sprite
{
private bool _isActive;
public void SetActive(bool isActive)
{
_isActive = isActive;
}
}
static void Main(string[] args)
{
List<Sprite> sl = new List<Sprite>();
for(int i = 0; i<100; i++)
{
sl.Add(new Sprite());
}
Stopwatch spw = new Stopwatch();
spw.Restart();
for (int i = 0; i < 50; i++)
{
sl[i].SetActive(false);
}
Console.Write(1e6 * spw.ElapsedTicks / TimeSpan.TicksPerSecond);
Console.WriteLine(" microseconds");
Console.ReadLine();
}
}
}
On my system (a five year-old i7) this produces a result typically between 20-30 microseconds. If you consider a target performance of 100fps, that's 10ms per frame, so this operation is consuming about 0.3% of your time budget per frame. Do you think that's worth worrying about? I don't. Just write the code so that it is readable and makes sense. Worry about performance when it becomes a problem.