This works fine when there are only a couple answers in the database - but eventually the view would have to iterate over many thousands of answers and this will take a very long time while the user waits for the page to display.  

See if you can store only the appropriate answers in the $unit object (in the get_unit_with_id() function - units_m) and then just pass that object to the view.
Even better would be to put the answers inside the appropriate the question - so the view doesn't have to check at all.
Example:
unit {
   'id' => 1,
   'title' => 'example Title',
   'primary_material' => 'whatever',
   'secondary_material' => 'whatever',
   'questions' => array(
        [0] => {
              'question' => 'Example question 1?',
              'answers' => array(
                      [0] => 'Example answer to question 1.',
                      [1] => 'Another example answer to question 1.'
              ),
        [1] => {
              'question' => 'Example question 2?',
              'answers' => array(
                      [0] => 'Example answer to question 2.',
                      [1] => 'Another example answer to question 2.'
              )

        }