title: How to make TextMeshPro Input Field work in layout?
body: <p>I'm having odd issues trying to use Unity's Text Mesh Pro Input Field UI element. I don't actually know if the layout is causing it though. </p>
  
  <p>I have a scroll view which uses a vertical layout to organize objects under the content object. Each object in the scroll view has a horizontal layout inside it which fits two input fields next to one another so essentially the Scroll view has two columns of input fields. </p>
  
  <p>However I'm getting odd behavior from the input field. When I start typing it won't show the input until I've entered two characters (i.e. I type '0' and it shows nothing then I type another '0' and it will show '00'). Additionally I have some code that automatically populates the input field with default value, below is an example of how I do this:</p>
  
  <pre class="lang-cs prettyprint-override"><code>gameObject.GetComponent&lt;TMP_InputField&gt;().text = numVal.ToString();
  </code></pre>
  
  <p>However the values never show up, but I can confirm that they are being populated by checking the inspector window while the game is running. Under the TMP_Input Field component, the 'Text' field shows the correct value but I can't see it in the input box.</p>
  
  <p>I'm getting no errors or warnings.</p>
  
  <p>Is it the scroll view or the layered layouts that are confusing the Input Field's script? Something else? Any advice, help, and questions are appreciated.</p>
  
  <p><strong>EDIT:</strong><br>
  I've found that it may have something to do with the way the objects are added to the scroll view. The content of the scroll view (which has the vertical layout) get's objects added to it during run time. This is done through instantiating a prefab.</p>
  
  <pre class="lang-cs prettyprint-override"><code>Instantiate(DoubleInputNodePrefab, contentObject.transform);
  </code></pre>
  
  <p>This prefab object has the horizontal layout and two children, each an input field. If I add this prefab to content window before I run the game it works fine (expect that none of my intended code works since it relies on modularly adding and removing these objects) but I can give input and it looks fine.</p>
  
  <p><strong>WORK AROUND</strong>: 
  I won't consider this a solution but it is a work around I'm going with for now. Using a 'normal' input field rather than a Text Mesh Pro one doesn't create the same issues and works as intended. </p>