Hi, Invoking a specified Func every frame allocates memory, do you maybe know workaround for this?
I’m doing func list to execute in order, when func returns true → next func in executed:
private LinkedList<Func<bool>> actionList = new LinkedList<Func<bool>>();
void Awake()
{
actionList.AddLast(() => FunctionDoSomething());
actionList.AddLast(() => FunctionDoSomething2());
}
void Update()
{
if (actionList.Count != 0) {
while( actionList.First().Invoke() )
{
actionList.RemoveFirst();
if (actionList.Count == 0) break;
}
}
}
private bool FunctionDoSomething(){ return (something == "nope") }
private bool FunctionDoSomething2(){ return (something == "meh") }