What is this object in the cockpit of an ultralight? This is a tool (probably) in on an ultralight airplane. Initially I guessed that it is a tilting meter (to level between right and left), but seems it is not as it just a vertical tube filled up with something like liquid.

So, what is that and how does it work?
It's an airspeed indicator for ultralights.  The pitot inlet is at the bottom and the pitot air pushes a little red plastic disc up and down on a central rod, with a calibrated clearance between the edge of the disc and the walls of the tube.  They are very sensitive and are good down to 10 MPH or less.  You'll also see them on hang gliders. 

See here:
https://www.aircraftspruce.com/catalog/inpages/hallwindmeter.php?clickkey=5468