I am relatively new to memory and optimization. I was tasked to optimize an existing project and while looking at the profiler in Unity, I saw that there was a function producing a bunch of stuff for the GC to clean up.
The function is as such:
public bool AnyCanvasOpen()
{
for (int i = 0; i < canvasList.Count; i++)
if (canvasList[i].activeSelf && canvasList[i].name != "MainUICanvas")
return true;
return false;
}
where canvasList is just a list of GameObjects. What could be the cause of my 282B allocation?