Aligning two GUI elements

Hi!,

I am fiddling for quite some time now to align a “meter” (GUI element at the top of my window) with a small sprite on top (the indicator of the meter).

When I resize my window, the indicator is not position correctly on the meter anymore! I tried everything, reading the docs on how alignment works, but it still moves away.

The meter texture is 512 x 128
The indicator is 32 x 32

How can I align them correctly?

Thanks!

And a smaller window results in mis-alignment:

The sprite should be a separate game object, you can set it as a child of the meter.

Can I ask you what kind of game are you making? It looks interesting.

Thanks! Duh, a child object should do that!!! :roll:

I am making a serious game, to prevent people on a bike colliding with the “dead angle” of large vehicles.

Currently you are seeing temporary 3d models; they will be replace with final artwork soon, so I’ll show you the result then :slight_smile:

Hummm… I think you should invert the game idea: large veicles hunting bikes would be more funny!
:smile:

You want to use the transform position to center it on the screen, independent of the resolution of the screen.

Then use the pixel inset to move them relative to that. The important part is that all the gui texture which you are trying to align should use the same transform position and should be offset from each other using pixelinset.

True, but the Ministry of Traffic wouldn’t exactly be happy 'bout that :slight_smile:

Joachim, thanks! I am going to try that out instead of the child stuff because I can’t easily control it by scripting this way.