playMaker

Author Topic: Listing an array as text  (Read 1877 times)

Drahgoone

  • Playmaker Newbie
  • *
  • Posts: 10
Listing an array as text
« on: June 28, 2018, 09:05:50 PM »
Hello, I have an array that is a list of players, and I am trying to display this list of players as text. What is the best way to do this? I tried just displaying it as is, but it said "Empty" so I assume I have to create a new object for each name in the list, although I am not sure. Thanks in advance!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Listing an array as text
« Reply #1 on: June 29, 2018, 07:09:01 AM »
Hi.
You need to use 'array get next'
This will loop thru the array.

Then you can use a build string in combination with a custom action from the Ecosystem called String Add New Line.
This way you can place them in a single string.

if you want them separate you can use a pool or (pooler package on the Ecosystem) or create a new object as you said.

Here is a video explaining how to use arrays :


Drahgoone

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Listing an array as text
« Reply #2 on: June 29, 2018, 01:40:24 PM »
Thanks! Using pools I was able to spawn in different buttons, one for each array item, however they spawn ontop of each other, and I am having difficulty specifying that the new object should be below the one previously spawned, any idea how to do this? Thanks!

verybinary

  • Junior Playmaker
  • **
  • Posts: 81
    • The Museum of Digital
Re: Listing an array as text
« Reply #3 on: June 29, 2018, 02:00:08 PM »
maybe the buttons can already be there and you can replace the text in the buttons with the strings from the array?
maybe you can set another array with positions that the buttons will be placed with? or if the buttons are all in a vertical stack, create the button, and translate it down?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Listing an array as text
« Reply #4 on: June 30, 2018, 12:27:19 PM »
Hi.
You can use Layout Groups, you can find many unity tutorials for this and most are without coding.

With this it will automatically re position what you place into them.