playMaker

Author Topic: Combine string and int in a GUI text?  (Read 6120 times)

nypraise

  • Playmaker Newbie
  • *
  • Posts: 6
Combine string and int in a GUI text?
« on: June 25, 2013, 09:14:38 AM »
How do I combine a string and int in a GUI text? Right now I have an int that changes value when player collides with coin. I have converted the variable toString and now it shoes the number. But I want it to show a text before the number. Is there some way I can have the text "Sum : variablename" like I would have if I coded it by hand?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Combine string and int in a GUI text?
« Reply #1 on: June 25, 2013, 09:17:52 AM »
GUI Int Label allows a Prefix text before the value.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

nypraise

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Combine string and int in a GUI text?
« Reply #2 on: June 25, 2013, 09:32:55 AM »
Thank you, but it still only show the number. First I "Int Add", Then I "GUILayout Int Label" and write the prefix and assign the int variable. Then I convert it to string, and then set it to GUI Text. I tried without converting to string, but GUI Text won´t find the variable if it is not a string. What am I doing wrong here?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Combine string and int in a GUI text?
« Reply #3 on: June 25, 2013, 09:36:22 AM »
Why not just use GUI Int Label instead of all that converting stuff? Use it in place of GUI Text.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

nypraise

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Combine string and int in a GUI text?
« Reply #4 on: June 25, 2013, 09:44:47 AM »
But how do I assign it to the GUI element I want to use? In GUI Text I just drag and drop. How does it work with the GUI Int Label?

nypraise

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Combine string and int in a GUI text?
« Reply #5 on: June 25, 2013, 10:57:51 AM »
Do I use PlayMakerGUI or can I use a GUI already made with Unity?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Combine string and int in a GUI text?
« Reply #6 on: June 25, 2013, 11:13:20 AM »
What exactly are you trying to do? I don't fully understand your questions.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

nypraise

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Combine string and int in a GUI text?
« Reply #7 on: June 25, 2013, 11:24:55 AM »
I have this GUI I made in Unity called GUI_SUM. When I set the gui text I can "Specify Game Object" and drag/drop the GUI_SUM to the Set GUI Text action. When I use GUILayout Int Label I can spesify the game object, so how do I assign (tell what gui element to change) it to GUI_SUM. So that when ever the variable I have defined in GUILayout Int Label with the prefix will be shown where GUI_SUM is placed in the editor.

Or do I have to create a new GUI element to show the int when using Playmaker?

Ps. I made the GUI_SUM etc. before I started using Playmaker.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Combine string and int in a GUI text?
« Reply #8 on: June 27, 2013, 01:03:25 AM »
Hi,

 I am not too sure what is at stake here neither, if you could share the code or explain with a use case that could help us pointing you in the right direction.

 You can certainly modify GUI_SUM to expose a public variable which would be the value you want playmaker to inject, then you use "Set property" action and target your GUI_Component and set that public variable.

bye,

 Jean