title: Unity3D C#: How to resize an inputfield according the content which is set dynamic
body: <p>I've got an InputField where the text is filled in upon getting a string back from the server. We can debug the entire text so we receive it correctly. However the text is too long to fit in our InputField.
  What I basicly need is the idea of the content size fitter provided by unity (Content size fitter isn't supported for InputFields by design)
  At the moment we are trying to update the size of the InputField with the following snippet of code.</p>
  
  <pre><code>var x = new GUIStyle();
  var rectTransform = pvText.GetComponent&lt;RectTransform&gt;();
  var words = pvText.text.Split(' ');
  var currentWidth = 0f;
  var currentHeight = 0f;
  foreach (var word in words)
  {
       var size = x.CalcSize(new GUIContent(word + "A"));
       var height = x.CalcHeight(new GUIContent(word), size.x);
       currentWidth += size.x;
       if (currentWidth &gt;= rectTransform.sizeDelta.x)
       {
          currentWidth = size.x;
          currentHeight += height + pvText.textComponent.lineSpacing;
       }
   }
   rectTransform.sizeDelta = new Vector2(rectTransform.sizeDelta.x, currentHeight);
  </code></pre>