score:14
Yes, this counts as entering the Schengen area. If you will be in Hungary at midnight, it will even count as two days.
With trains, you're generally processed into and out of each country when you actually cross the border. There are some exceptions, but the trains you are contemplating are not among them.
Upvote:8
The concept of transiting a country's soil without entering the country only exists at airports, with only a couple of provisions for such transit by land transport in the world.
So yes, you'll obviously enter the Schengen Area, with border control taking place at the border.