using UnityEngine;
using System.Collections;
public class textdisplay1 : DestrroyOnClick {
public TextAsset asset;
public int searchWord (string a) {
var aTemp : String[] = tWordList.text.Split("
"[0]);
return 1;
}
}
using UnityEngine;
using System.Collections;
public class textdisplay1 : DestrroyOnClick {
public TextAsset asset;
public int searchWord (string a) {
var aTemp : String[] = tWordList.text.Split("
"[0]);
return 1;
}
}
You’re mixing Javascript and c#, if you want to split a string based off new line, give it a couple options for different platforms to split on, i.e.
and
I assume the variable tWordList is derived from DestrroyOnClick or somewhere down the chain as there isn’t a direct reference in the textdisplay1 class.
using UnityEngine; using System.Collections;
public class textdisplay1 : DestrroyOnClick {
public TextAsset asset;
public int searchWord (string a) {
string[] aTemp = tWordList.text.Split(new string[] { "
", "
" }, StringSplitOptions.None);
// display string array items in Unity Console for sanity check.
if (aTemp != null){
for (int i = 0; i < aTemp.Length; i++) {
Debug.Log("WordList Word: " + aTemp*);*
}*
}*
return 1;*
}*
}