Unity interview question

Solving coding questions to a certain situation.