Some characters I get a feeling for right away, before it becomes relevant to the plot. Most of the time however I admit that they default to straight (if they live in a society where being heterosexual is expected) until the story gives me reason to think otherwise. For example, a character who I had a vague idea of how I wanted his arc to end but couldn’t solidify what would actually happen. On a whim I thought “what if he fell in love with another male character” and then it just felt right with his background and personality.
I don’t like to be one of those “they need a REASON to be gay” people but most of the time I just don’t think about characters’ sexuality. It defaults to whatever
