Optimizing Coroutines

Andrea Alicino
Oct 19, 2021

The profiler gives us the tools to find where we are wasting resources, once identified we must understand how to optimize it.

We have already said that the print commands on the console use a lot of resources, especially when they are constantly called in the Update method. We have to pay attention to what we write in the Update. Also in the Coroutines, we should be careful because they are always running.

In the Coroutines, we can optimize the code by removing the keyword ‘new’ and creating beforehand the variables that we need.
The simple step of declaring the variables and initializing them in the Start method allows us to lighten the workload.

--

--

Andrea Alicino

Game Developer Unreal Engine/Unity. Computer science graduate. Seeking new opportunities.