Return array of strings

Hello all,

I have a code like this that cant work. What is the problem?

public string[] getHealthPickupTag()
    {
        for(int i = 0; i < myPUM.healthPickups.Length; i++)
        {
            return myPUM.healthPickups*.gameObject.tag;*

}
}
I am saying to it that I have a array but why it says it can return only one value?
Thanks for any help.

well you need to return an array of string, right now i assume you return a single string(tag) which isn’t a valid return. you might want to try this:

public string[] getHealthPickupTag()
     {
          string[] s = new string[myPUM.healthPickups.Length];
         for(int i = 0; i < myPUM.healthPickups.Length; i++)
         {
             s _= myPUM.healthPickups*.gameObject.tag;*_

}
return s;
}

thanks @dan_wipf it works but I added a line of debug.log(getHealthPickUpTag()) but it prints only (object). why? means it does not show me the array that stored in s.
and how can I store these array produced from that s in new array to use them later? Basically I am trying to get tags of some pick ups which might be different number in each scene then store them in another array to use later. (if I want to be clear I need to do this for serialization for save system)

thanks for help