I was speaking to the Livingston MP Hannah Bardell the other day about her town’s bid for city status, but we also talked a bit about what it was like for her growing up gay in the 80s and 90s. “It was grim,” she said. “I didn’t come out ‘til I was 32 and there was a good reason for that.” The question is: has it got better?

On the face of it, it absolutely has. Hannah said one of the reasons she stood as an MP in the first place was she looked at Westminster and saw there weren’t many people like her: working class gay women. As it happens, by winning the seat for the SNP in 2015, she helped increase the number of openly gay MPs from 26 to 32 making Westminster one of the gayest parliaments in the world.

There are signs of progress elsewhere too. Gay marriage is ubiquitous. Section 28 is ancient history. Openly gay pupils at school are not uncommon. And there are also lots of LGBT role models in film and television. The trans actor Annie Wallace, who was an advisor on the Hayley character in Corrie, told me that she’s been taken aback sometimes by how much things have improved in recent years.

But let’s not get too carried away here because a country should be judged not only by how much has changed but by how much hasn’t. Annie said growing up in Aberdeen was bleak. “Gay people were being absolutely pilloried,” she said, “And trans people were being beaten up constantly.” Hannah Bardell was also so discouraged by what she saw around her that she felt unable to be honest about her sexuality for a long time. “Everything you saw was a heteronormative ideal,” she says.

The problem is that, even today, many people are still going through the experiences Annie and Hannah faced – indeed, in some respects, it could be getting worse. You may have noticed over the weekend that the shadow social justice secretary in Scotland, Jamie Greene, asked the Scottish Government for their latest data on hate crimes recorded against LGBT people and the figures they produced in response were pretty alarming.

Judge for yourself. Since 2014, Scots have been abused due to their sexual orientation more than 7,500 times. There has also been a 27 per cent rise in the number of hate crimes aggravated by sexual orientation or transgender identity in the six years from 2014. Mr Greene’s word for it is depressing. “We’re constantly being told that attitudes towards sexuality are becoming more tolerant and progressive,” he said, “yet these figures tell the opposite story.”

Obviously, any figures on hate crime need context and it would seem entirely possible that the reason some of the crimes are being reported is partly because the police are more interested and aware of LGBT hate crime and it has received more publicity. The support for trans people in particular is also much better than it was for the likes of Annie Wallace in the 90s and this will undoubtedly have led to more cases of abuse and hate crime coming to light than would have been the case 30 years ago.

But having said that, the reported rise in hate crime requires a bit more examination and I’d like to suggest some possible explanations for it, with the caveat that they are only theories. I do not know what goes through the mind of someone who singles out a gay person on the street to abuse them or hit them or draw blood, but we should at least try to understand what’s going on so we can stop it happening – or at least stop it getting worse.

The first possible explanation, it seems to me, has to be the ongoing debate about trans rights. The right of trans people to identify their own legal gender has been introduced in several other countries no problem, but for some reason the debate in Scotland has been characterised by accusations that trans people will abuse the law and attack women. It reminds me of the kind of arguments that were used to oppose the equalisation of the age of consent in the 90s – and would it be surprising if an argument predicated on trans people as abusers led to trans people themselves being abused? Hate leads to hate leads to hate.

The second possible explanation, as Jamie Greene points out, is education. The Scottish Government, he says, needs to do more to ensure young people are better educated on sexuality and tolerance and he’s right. But will the government ever be willing to take on the faith schools that teach same-sex relationships are wrong? And will it ever be willing to talk about the uncomfortable truth that anti-gay prejudice is more likely in poorer and less well-educated communities? To fix that problem requires targeted help and support but first of all it requires an admission of what’s really going on.

The third possible explanation is something that’s a little harder to pin down but let me tell you about an interesting conversation I had with the Very Rev Kelvin Holdsworth, rector of St Mary’s Episcopal Cathedral in Glasgow. Mr Holdsworth knows a thing or two about the realities of hate crime – not only is he gay, he was the victim of death threats when he invited Muslims to one of his services and asked for the Koran to be read in his church. In fact, on the day I visited his cathedral, two police officers called round to discuss the most recent threats.

As far as Mr Holdsworth is concerned, the recent attitude of the police is one of the positives. There was a time, he said, when hate crime wasn’t taken as seriously as it is now, but he was also convinced that an atmosphere in which hate crime is more likely has been created partly by the referendums first on independence and then on Europe. In his view, the referendums changed the way people think and made them more likely to hurl abuse.

You will almost certainly have a view on Mr Holdsworth’s argument; you may dismiss it. But all I would say to you, if you doubt him, is switch on your computer and log on to social media for more than a few seconds. And if you also question the idea that Scotland can be a hateful place - and that it may be getting worse – perhaps you could speak to one of those 7,500 gay people who’ve been abused for their sexuality since 2014. Maybe they’ll tell you everything’s fine. Maybe they’ll tell you nothing has changed. Or maybe they’ll tell you that they’re worried and depressed, and that action is needed.

Our columns are a platform for writers to express their opinions. They do not necessarily represent the views of The Herald.