Use width of BBText object in event condition

Short version: Is there a way to get the width of a BBText object in a event condition? I know have access to it in an event action, but I would like access to it in a condition as well.

Long Version: I get my games translated so my text one in language of my game is not always the same size at the text as another language. And, seeing how my text usually overlays a button I want to do something like this for responsiveness.

if (BBtext.width() >= sceneVarMinWidth) {
button.width() = BBtext.width();
}
else {
button.width() = sceneVarMinWidth;
}

Currently, I don’t have access to BBtext.width() as a condition, so I get around it, but using a second scene variable, storing the BBText.width() in there, and then checking it instead.

But this seems like a waste. Is there a better way to do this? If not, can a feature request be added to get the BBText.width() available in an event condition. (S/N while writing this I just realized that this can be done using javascript as well, but I’m trying to avoid that as much as possible)

I would use the compare two numbers condition. You can directly put the .width expression in there.

1 Like

I wasn’t aware of that condition. That is perfect. Thanks!

1 Like