Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Drahgoone on June 28, 2018, 09:05:50 PM

Title: Listing an array as text
Post by: Drahgoone 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!
Title: Re: Listing an array as text
Post by: djaydino 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 (https://hutonggames.fogbugz.com/default.asp?W1181) 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 (https://hutonggames.fogbugz.com/default.asp?W1181)) or create a new object as you said.

Here is a video explaining how to use arrays :

Title: Re: Listing an array as text
Post by: Drahgoone 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!
Title: Re: Listing an array as text
Post by: verybinary 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?
Title: Re: Listing an array as text
Post by: djaydino 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.