If you were to ask anyone who works in mental health, (ANYONE: inpatient, outpatient, telehealth. Doctors, nurses, social workers, technicians, therapists, the people who cook the food and mop the floors) - any of them can tell you that housing is the number one driver of the mental health crisis.
From my inpatient perspective specifically, I can tell you that about 2/3 of the bed occupancy of any inpatient unit in the country is literally just homeless people. They're there for "passive suicidal ideation" or "mild psychosis" that clears up within 12 hours of admission and seems to be caused by cold weather. I've known so many people who tell me their loved one desperately needed inpatient mental health care and couldn't get it because there were no beds. Even when I was a kid and my sister was beating the shit out of me and the rest of my family, they never had enough beds to take her. I got my back broken at 16 because our mental health system is being forced to handle a problem it was never designed to and it has been for years now.
And I don't even blame the homeless patients! I would do the exact same thing; it's a matter of survival. I won't blame people for seeking literal physical safety. And even beyond that, I don't want my job to be figuring out which people are lying about their mental illnesses. I don't think I could stomach my job if I were trying to decide which person was more suicidal or in more emotional pain than another. And we would have the resources we needed to not have to bother asking those questions if we weren't bogged down by being forced to handle a problem we have no business being that involved in.