She was in another part of the house and had no idea her stalker was rifling through her underwear; the man left with a bra and underpants.
Over the following weeks, there would be about 20 such break-ins.
The defendant appeared in the Dunedin District Court last week facing a charge of burglary and being unlawfully in an enclosed yard.
Judge Jim Large sentenced the man to five months' community detention and 18 months' intensive supervision.
The defendant, described by counsel John Westgate as "a loner", had no explanation for his behaviour and psychologists who assessed him were also stumped.
Westgate said the motive was not sexual — his client did not plan to sexually assault his victim.
Instead, he argued, the man was attempting to establish a "romantic connection".
The defendant said as much to the police when he was apprehended but added that his "ultimate goal was to have sex with her".
Westgate, supported by clinicians' reports, said his client's state may regress if his identity was publicised.
Despite arguments by the Otago Daily Times in opposition, Judge Large made an order permanently keeping the man's name under wraps.
He said the victim and her family did not object to the man being granted suppression.
"That shows a great degree of compassion," he said.
The victim's mother, though, outlined how her daughter had been terrorised by the stalker's incessant behaviour.
"She was scared, angry and confused. I was extremely worried about what this guy would do next. Could he have a knife?" the woman told the court.
"He could have raped her or harmed her. I was nervous he was psychotic."
The defendant admitted to police he would go to the victim's flat in the early hours of the morning and snoop around, wearing a hoody to disguise himself.
On one occasion he tried to open her bedroom window while she was in bed and on another opened the door to her room when she was inside.
After the burglary, he also contacted her on Instagram from an account with the username "mypantiesnow".
The victim's mother said there were instances where people had to chase the defendant away from the flat during his late-night escapades.
When police executed a search warrant at the man's home on September 24, they found the stolen underwear.
Westgate said his client wanted to assure his victim that he planned to move on.
If he saw her in public, there were "strategies" in place, he said, to avoid a confrontation.
The judge described the case as "disturbing".
"Your infatuation with her is, on one level, something that happens to all young people at one point but your behaviour was unforgivable. If you wanted to speak to her, you should have approached her and given her the choice of saying yes or no ... but you did not,'' he said.
"You chose effectively to stalk her."
Judge Large said he remained concerned about the man's potential risk to the community.