Hi,
when I import text from a .txt and try to compare the text of it and the text of an InputField, it does not work. Except that I managed to find the problem is that if I run my game and put the same thing in InputField and in my Text, I have to remove a space in the text import for it to work. It’s as if there was an invisible space or something else.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Script : MonoBehaviour
{
public TextAsset textFile;
public Text displayWord;
public InputField inputWord;
public int line;
public string[] textLines;
void Start()
{
if (textFile != null)
{
textLines = (textFile.text.Split('\n')); //To have the line of the .txt
}
displayWord.text = textLines[line]; //To take the work of .txt and writte this in "displayWord"
}
void Update()
{
//If the word displayed is the same written in "inputWord"
if (inputWord.text == displayWord.text)
{
Debug.Log("It's work ! 1");
Next();
}
}
public void Next()
{
line++;
inputWord.text = "";
displayWord.text = textLines[line];
}
}
Where is the arrow, i need to wipe off. And when i do that, it’s work ![]()
