OP
re your comments in quote marks:
"We own our house together and after selling I have no chance to get my own property and that is the major factor why I havent just left. My daughter needs to have a roof over her head so I appreciate all the ” dump him now” advice but it is easier said than done".
The current home may well end up being sold or you may be able to live there with your child until she is 18. Until you yourself seek legal advice do not rely on mere supposition. Your daughter I feel would much rather live in accommodation where she and you can live happily together rather than she seeing you stressed out and otherwise preoccupied all the time. For all you know she may well be blaming herself for her parents' marital troubles.
It's not easier for you or she to stay with such a man either. He is a terrible role model to her and a crap example of a husband to you.
How would you feel if she went on to marry or partner up with someone just like her dad?. You are currently showing her that this is still acceptable to you on some level.
"I do consider having an affair for the first time in my life to just feel nice at least in short term".
As if an affair is going to solve anything. Give your head a wobble and stop thinking such nonsense right not. If you are thinking this then end your marriage first before potentially blowing up another marriage for your own self based reasons. And then you will be found out and your H will use that as a further stick to beat you with. Your own relations then with your daughter could further decline and she may well not want to know you. You need to remain whiter than white here in her eyes as well as being a consistent parent (unlike her dad).
"As to him being a dad…well he does homework with our daughter, drops her off /picks her up from activities so I suppose it is not all that bad! It’s him treating me like s..t/ second best is the major issue here".
He is doing the barest of bare minimums here and you know this. Again he is no example of a father to his child. Again look at what both you and he are modelling here to your impressionable 12 year old daughter. You are both laying the foundations here for how she is going to get on in her own adult relationships.
"Thank you for all your responses … and private messages. Glad I am not the only one in a terrible scenario like this".
You have a choice re him and your child does not. Make better choices with both you and she kin mind going forward. Not him. She is relying on you to make good choices with both you and she in mind.