Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: 4ppleseed on January 23, 2017, 12:39:07 PM
-
Hello,
lets say a have some strings: Monday, Tuesday, Wednesday etc.. and I can also generate some INT numbers between 1 and 31 and convert them to strings.
In Unity's UI how can I insert those two stings into a sentence?
As in You were born on day 24 which was a Wednesday
and then insert them into another...
You were born on day 3 which was a Monday
That sort of thing, is it possible with Playmaker without having to use multiplay Unity UI text boxes?
Thanks 8)
-
Heya,
I can think of two ways to achieve this.
a) Just build the string you want with a "build string" action... this lets you combine set pieces and variables into a new string or
b) Use "string replace" or "string regex replace", depending on your needs, to replace certain parts of a string. This is more interesting for when you have texts read out of an xml file for example. You'd have an initial string like "You were born on day [z] which was a [y]." and then just replace [z] with the day number variable and [y] with the day name variable.
The second way can get more complicated but is more flexible and better suited for dynamic content imo.
cheers
-
You are totally right - I didn't even realise Build String was already built into PM. I must have overlooked it a million times.
Thanks!