How to prevent automatic GUI scaling?

I ran into a similar issue. +1 on a “None” option. The way I solved it is by inferring the scale of the gui in the render script, sharing it globally, and then applying the inverse of that scale to every gui element in the gui script.

-- in .render_script update
-- share gui scale globally so that we can reverse it in our gui script (this blackboard is my own thing, you can use a global table)
-- this guess at the gui scale assumes that "fit" adjust mode is used on all elements whose scale you want to override
blackboard.set(global_blackboard, "gui_scale", math.min(render.get_window_width() / render.get_width(), render.get_window_height() / render.get_height())
-- in .gui_script update
local gui_scale = blackboard.get(global_blackboard, "gui_scale", 1)
local inverse_gui_scale = vmath.vector3(1 / gui_scale, 1 / gui_scale, 1)
-- collect all of the gui elements that you want to be unscaled via some method of your own
for k, v in pairs(gui_elements) do
    gui.set_scale(v, inverse_gui_scale)
end
1 Like