The two main qualities are consistency and sensibility. Consistency just means that the character you're seeing play out in the story matches the way the story focuses on them. For example, if your character is a scumbag who is always picking fights, don't try to suddenly drop sympathy cards all over them while ignoring all of the horrendous things they did. In other words, if you want to write a villain, treat them like one. One really nasty habit I've seen in some stories was they wanted to have a stone cold, cruel and sadistic villain(ess) who does some really horrible things, but as soon as they start losing, the story suddenly starts talking about their tragic past and how much pain and loneliness they feel, and really you should feel so bad for them and they needs to be protected...
You're shooting yourself in the foot with something like that. The sadistic, cruel dominatrix side of a character is suddenly crying on her knees begging for pity, while the innocent little baby side has a Geneva Checklist tallying up. One game I liked had an annoying habit with a character who was like that when she actively tortured and slaughtered her own countrymen as she betrayed them to the invaders as her own power play. It felt like hours of a pity party over her backstory, all while half the population is suffering from serious PTSD from her actions while the other half is dead or dying. There really are some things that are inexcusable. And I have a lot of villain characters I love, whether they're manipulative, psychotic, murderous, vengeful, you name it. Those things alone don't make a character unlikeable. The character themselves can even be a hypocrite about things, as long as the focus of the story isn't full of hypocrisy over them.
Sensibility means there's a throughline with the character's actions. They don't necessarily have to make sense or be the most logical choice. Real people aren't logical constructs either. All that matters is you can see why they would go with one option over another. Have them make mistakes, get things wrong, make bad calls, you name it. It becomes annoying when the audience doesn't go "you should have known better" but rather "why in the world would they do that".
The hero lowering his gun because he fell for the bad guy's bluff is him making a blunder. Maybe he has really good reason to not want to risk things, whether self doubts or past trauma or being naive. On the other hand, the hero lowering his gun when he has a clean shot at the villain, then doing nothing as the villain comes over to punch him in the face and take the gun, then it leads to the villain putting him in a James Bond elaborate death trap that can easily be escaped from... At that point, the audience just assumes everyone is brain damaged and doesn't know how guns work despite clearly intending to kill each other.
There's definitely other cases, but these are the two most common factors I notice in stories in any medium. With consistency, flawed characters shouldn't be coddled and shown how their flaws secretly aren't actually flaws at all, just looks cowardly on the writer's behalf in most situations. With sensibility, flawed characters should have their flaws be harrowingly understandable, so they leave a bittersweet taste instead of just a bitter one. The audience should feel disappointed with their decisions and actions in the way you would about a troubled friend, instead of feeling confused about things seeming random and nonsensical.
When a character is consistent and sensible, you can appreciate all the random BS they get up to. The girl who has a gesugao every other scene drove a truck through the wall? Yeah, sounds about right for her. The guy struggling with alcoholism is doing well up until the case he's on crashes down all around him, and he reaches for the bottle? Now it just feels even more tragic, and I'm really itching for things to finally turn around for him. The hockey mask wearing murderer sees a small child, forlornly looks away, and walks off peacefully? That felt out of the blue, but other characters make sense, so I want to see where they're going with this.
That was longer than I meant it to be, but hopefully you can get something out of it.