Search Unity

comparing input string to string in array

Discussion in 'Scripting' started by KhmerDude, Jan 11, 2016.

  1. KhmerDude

    KhmerDude

    Joined:
    Oct 18, 2012
    Posts:
    105
    public void compareString( string myString){
    for(int counter = 0; counter < arrayString.Length; counter++){
    print(arrayString[counter]);

    }
    }

    Hi, I have this function in my second script.I was able to get the input from user and pass it to my second script as myString. Im trying to compare it to my array string but it wont allow me so I try to print out the arrayString value but it give me this unityengine monobehaviour:print(object).
    the arrayString is declare and given value of string already.
    does anybody know how to solve this issue. I would like to know so I can use this value to compare it to my input string.
     
  2. Boz0r

    Boz0r

    Joined:
    Feb 27, 2014
    Posts:
    419
    1. Use code tags.
    2. Could you show where you assign the variables?
     
  3. KhmerDude

    KhmerDude

    Joined:
    Oct 18, 2012
    Posts:
    105
    i declare my array in the class and initialize it with a few string