Forcing a GUI box to have the same size as the sprite it's using

Right now there seems to be no way to make GUI boxes automatically have the same size as the sprite source. It would be nice to have a checkbox/similar for locking the size to the sprite dimensions, rather than having to look it up manually

1 Like

You got me confused there for a second. I assume you mean “locking the size to the texture dimensions” and not to a sprite component that happens to exist on the same game object?

:slight_smile: And I assumed you meant a way to just automatically enter the dimensions of the currently selected texture into the dimensions of the node? I.e. not a “lock” feature but a button in the editor or similar.

Confusion of terms!
I meant sprite as in, a slice of an atlas. I presume the texture would be the entire atlas, although it does say texture in the property window of the GUI box, so, my bad, I suppose!

But yes, a checkbox in the GUI box Property window, to force it to use the same resolution as the “texture” assigned in the Texture field.
Either that, or a “force proportions” checkbox, keeping its aspect ratio when you edit size X or Y.

Requesting it as an editor only feature, as in, it wouldn’t keep forcing it in-game

1 Like

I would vote for “pixel perfect” size button, next to texture-assignment. Which updates the size property fields to match that of the given texture, without constraining changes to the size from then on. Otherwise confusion might arise that changes to the texture in run-time would cause it to automatically resize. Sure if switching the textures, it could be annoying to not see the size before pressing the button, but you probably won’t use it as a preview.