playMaker

Author Topic: Passing text to EZ Gui Label control...  (Read 7351 times)

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Passing text to EZ Gui Label control...
« on: November 18, 2011, 04:35:45 PM »
I am writing a script using Play Maker to pass text into the Label control. I need to do multi line text some with auto wrap and some with forced new line using "\n"

Now if i hard code the text like this "line one /n line two" it works fine... but if i pass a variable to it it does not work.

I tried both a normal string and an FsmString variable..

Does anyone know why this would be and how to get it to work?

Q

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Passing text to EZ Gui Label control...
« Reply #1 on: November 18, 2011, 08:14:59 PM »
Ok so i can manually assign a variable - FSM or normal to a string in the script and it works fine but if i pass information to it from inside Unity and an FSM then it does not work so something is happening to the string on its way to the script??

Q

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Passing text to EZ Gui Label control...
« Reply #2 on: November 18, 2011, 11:09:01 PM »
Can you email me a simple repro project?

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Passing text to EZ Gui Label control...
« Reply #3 on: November 18, 2011, 11:11:51 PM »
Well it is in EZ GUI... i guess that will come across too..

Will try to make one up.

Q

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Passing text to EZ Gui Label control...
« Reply #4 on: November 18, 2011, 11:30:27 PM »
So is there a way to make a new Scene and put in a few things and then save out a project that only has that scene and what assets it needs.. like a gather resources kind of thing?

Q

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Passing text to EZ Gui Label control...
« Reply #5 on: November 19, 2011, 12:39:31 AM »
I sent you a project. Hope it works..

Q

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Passing text to EZ Gui Label control...
« Reply #6 on: November 19, 2011, 01:34:18 PM »
Apparently this is a problem with Unity text fields:
http://answers.unity3d.com/questions/16865/making-newline-n-in-inspector.html

Ctrl-enter works for me, but then you can't see the text you've written!

The TextArea UIHint attribute is designed to show a text area for a string variable in an action, which works better for multi-line text. However, it doesn't work with FsmStrings, just string variables. I'll fix that in the next update.

Anyway, if you want to use the TextArea attribute, change your variable to a string and add: [UIHint(UIHint.TextArea)]

Does that help?

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Passing text to EZ Gui Label control...
« Reply #7 on: November 19, 2011, 01:43:01 PM »
Not quite sure what you mean... Did you try it in my project?

I am just heading out so i will play with it when i get back or tonight..

Just not sure how i implement this into my script so that it allows me to pass text from an FSM using a variable.

But i will try.

Q

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Passing text to EZ Gui Label control...
« Reply #8 on: November 19, 2011, 01:59:42 PM »
Yeah, I tried it in your project. If you use ctrl-enter instead of \n you'll get a new line.

EDIT: Also editing your text in a text editor and pasting it into the text field should also work.

Basically \n is broken in Unity text fields (which Playmaker uses).
« Last Edit: November 19, 2011, 02:02:39 PM by alexchouls »

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Passing text to EZ Gui Label control...
« Reply #9 on: November 19, 2011, 03:31:12 PM »
Ok but that does not help me as i need to actually use variables not that text field... Hmmm i wonder if it never gets into that text field if it will work?

I am using another script to give me language translations so i get the proper text from a variable and then pass it to this script to put it to screen..

Q

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Passing text to EZ Gui Label control...
« Reply #10 on: November 19, 2011, 04:10:01 PM »
Ok so if i use the Area Text then i can manually enter it with the hard returns.. But that does not help me with the variable. I tried the keep it as a variable and it does not work like that either.. I use my script to get the text from my multi language document and then pass it to the script that updates the text and i get the same thing..

So hope there is a fix for this some how.

If it will be a while i will have to try and make a kind of parser to build a literal string in my script which will work.

Q

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Passing text to EZ Gui Label control...
« Reply #11 on: January 18, 2012, 01:32:21 PM »
Does anyone have any ideas on this? Some way i can use a variable to cause a new line feed?

Q

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Passing text to EZ Gui Label control...
« Reply #12 on: January 18, 2012, 02:43:31 PM »
Ok i had a thought and modified the String Replace Action so that it uses Hard coded values for the characters to replace and replace with.. Works fine. I put in ~ symbols to start a new line and they get replaced with '\n' using this script and i get a variable back that actually contains the new line code.

So this just might work fine for me.

Q