playMaker

Author Topic: UGUI Support needed  (Read 2424 times)

lioncirth

  • Junior Playmaker
  • **
  • Posts: 74
UGUI Support needed
« on: January 26, 2015, 02:12:53 PM »
Hi

I am trying to change my current GUI to the new Unity 4.6 UGUI.

I have downloaded the unity package from the wiki, however I am completely lost on how to display some text based on a variable...

I have followed the YouTube video but this only shows how to display text based on the slider and I dont want that.

The text I am trying to display is score.

I have two variables (score_i) and (score_s)

When the player picks up an object I have Int Add - Score_I + 1)

I then use Send event to my Hud manager, convert the int into a String and then use Tk 2d actions to update what score is being displayed.

I have no clue on how I would get a text UGUI to update based on what that specific variable is...

Any help would be appreciated!!

Thanks

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: UGUI Support needed
« Reply #1 on: January 26, 2015, 02:18:10 PM »
Have you looked at the Unity tutorials that explain how the new UI works? Sounds like you might be trying to mix with 2dtk and things are getting confused. You need to be sure you have a Canvas and all of the proper components to actually use the new UI system and its features.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

lioncirth

  • Junior Playmaker
  • **
  • Posts: 74
Re: UGUI Support needed
« Reply #2 on: January 26, 2015, 02:42:20 PM »
Hey

I have removed 2D toolkit and basically just have UGUI

I have a canvas and inside that canvas are two text elements.

A normal one that just has the text Score:

and then a text 0 which is positioned next to the score text.

I basically want this second text (0) to update to show the score variable whenever the players score increases.

Therefore what should happen

1) Player lands on a gem
2) score int increases by 1
3) send event to hud manager FSM
4) Hud manager FSM converts int to string
5) send event to text (0)
6) text 0 updates to show what the string is _ IE score

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: UGUI Support needed
« Reply #3 on: January 26, 2015, 02:55:53 PM »
You can use Set Property to modify the text component directly. Actually, pretty much everything with the UI can be modified with Set Property. You don't even need any actions, but since they make things easier there are some we have made here:

UI actions... These were started a while back during beta and we haven't gotten around to putting them into a proper updated package.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D