Is there a way to calculate the exact width I have to assign to label or a button, so that it would fit a specific string exactly, not shorter and not longer?
Is there a way to do it via unity or do I have to work with specific letter width and calculate the width of the word, and therefore of the word, based on that information?
You can try using GUIStyle.CalcStyle function. This will return Vector2 which is the width and height (without considering the word-wrapped text).