title: How do I properly use an int to change text in Unity
body: <p>I'm trying to make a text box where a character called &quot;Dugo&quot; tells the player something, but it isn't working. The script is supposed to change what the text says based on an int value. All of the buttons and text are connected up properly to the script and I changed it to a double but it still won't work. Can anyone help?</p>
  <p>Here is the code:</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  
  public class DugoText1 : MonoBehaviour
  {
  
      public double text = 0;
      public GameObject DugoBox;
      public GameObject DugoText;
  
      public void ClickTheButton()
      {
  
          text += 1;
  
      }
  
      void Update()
      {
          if (text == 1) {
              DugoText.GetComponent&lt;Text&gt;().text = &quot;text1&quot;;
          }
          if (text == 2)
          {
              DugoText.GetComponent&lt;Text&gt;().text = &quot;text2&quot;;
          }
          if (text == 3)
          {
              DugoText.GetComponent&lt;Text&gt;().text = &quot;text3&quot;;
          }
          if (text == 4)
          {
              DugoText.GetComponent&lt;Text&gt;().text = &quot;text4&quot;;
          }
          if (text == 5)
          {
              DugoText.GetComponent&lt;Text&gt;().text = &quot;text5&quot;;
          }
          if (text == 6)
          {
              DugoText.GetComponent&lt;Text&gt;().text = &quot;text6&quot;;
          }
      }
  
  
  }
  </code></pre>