Two men died after a racking collapse at an industrial estate in Yorkshire, a court heard.