Is there a reason we are not learning about Guard Blocks for functions specifically tied to one object? In this lecture, the perfect function would be “void LoadTask()” which provides more legible function body.
void LoadTasks()
{
tastListSO = savedTasksObjectField.value as TaskListSO;
if(taskListSO == null)
return;
taskListScrollView.Clear();
List<string> tasks = taskListSO.GetTasks();
foreach(string task in tasks)
{
taskListScrollView.Add(CreateTask(task));
}
}