playMaker

Author Topic: UI and GUI big problems[SOLVED]  (Read 6244 times)

VascBogdan

  • Full Member
  • ***
  • Posts: 118
UI and GUI big problems[SOLVED]
« on: March 07, 2015, 02:43:05 AM »
I used UI on everything, and now I see that PlayMaker action "Set GUI text" require GUI. I added GUI to my text, set the font, size and color but if I disable the "Text" it doesn't show me anything (well, in the Inspector it shows the number it has to show FROM the script, so it's working but not showing).




Please, help me as soon as possible because this is ruining everything.
« Last Edit: March 08, 2015, 02:28:13 PM by jeanfabre »

scr33ner

  • Playmaker Newbie
  • *
  • Posts: 13
Re: UI and GUI big problems
« Reply #1 on: March 07, 2015, 04:19:03 AM »
I feel your pain, you're not the only one!

http://hutonggames.com/playmakerforum/index.php?action=profile;area=showposts;u=8475

I've tried a couple different methods to update a text element spending almost a week to get it working- still nothing.

What's frustrating is setting property > text > name (pick a variable) doesn't actually change any real value just the name of the game object.

uGUI add-on is supposed to handle new Unity GUI- but that's left me with more questions than answers. The 3 instructional videos for it are < 5min... & it feels IRRELEVANT to what I need to get done.

Connecting a script is what I'm trying to get to work as it seems like the best option.


This is the code that I'm trying to integrate with Playmaker.

Code: [Select]
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
/// <summary>
/// Player stats:
/// Use this script to display player stats with
/// new Unity GUI elements. Variables should be
/// received from gObjHealthMgr FSM.
/// </summary>
public class PlayerStatDisplay : MonoBehaviour
{
public Text guiTxtHealth;
public Text guiTxtLifeCounter;
public Text guiTxtItemCounter;
public object guiHealthTxtr;

public int playerHealthInt;
public int playerLives;
public string playerHealthStr;
public string playerLifeStr;

// Update is called once per frame
void Update ()
{
//Debug.Log(playerHealthStr);
GUIPlayerHealthTxt(playerHealthStr);
GUIPlayerLivesTxt(playerLifeStr);
}

void GUIPlayerHealthTxt(string strHealth)
{
guiTxtHealth.text = playerHealthStr;
}

void GUIPlayerLivesTxt(string strLife)
{
guiTxtLifeCounter.text = playerLifeStr;
}
}

The problem is variables aren't being picked up- so HUD displays, nothing.

setScriptVariable.jpg is where I'm trying to set the script's variables & hudUpdateScript.jpg is supposed to call the update function.

I've not heard back from Hutong Games about this yet. I don't get why it's difficult to set the new GUI text field's value...

Don't mean to hijack this thread but we do have the same problems, hopefully Playmaker team gets to these issues.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: UI and GUI big problems
« Reply #2 on: March 07, 2015, 05:24:45 AM »
Hi,

 yes, this is indeed very confusing. There is now 3 different ways to display a UI text in Unity...

you are getting confused with GUIText component that is a standalone text component and Text component which is part of the new UI system from Unity.

when you are not sure about what a component does, simply click on the help icon on the component bar:

http://docs.unity3d.com/Manual/class-GuiText.html

 This will explain that this is a legacy system, still valid, but replaced by a much more powerful UI system.


 So I would strongly advise you use the new UI Unity system, and carefully read the Unity Manual on how to set it up before diving into it.

 and then, you go on the wiki and download the UGUI package that will give you everything you need to work with this new system:

https://hutonggames.fogbugz.com/default.asp?W1192

this package is a base for you to catch UI elements callbacks. You'll then find around 60 actions related to UGUI on the Ecosystem, that you can get conveniently via the Ecosystem by searching like you do in the action browser.

So, as soon as these various UI technics will be well differentiated in your mind, it's going to be easier to deal with, and  I agree, it's a bit messy...

Bye,

 Jean

VascBogdan

  • Full Member
  • ***
  • Posts: 118
Re: UI and GUI big problems
« Reply #3 on: March 07, 2015, 07:49:31 AM »
Hmm... I see it's complicated. I will try to gen these nGUI or whatever they are called and try them. Thank you, I will let you know ASAP if something is not ok.

ArcadEd

  • Playmaker Newbie
  • *
  • Posts: 2
Re: UI and GUI big problems
« Reply #4 on: March 08, 2015, 03:27:22 AM »
I have the new addon and I am still struggling with the basics of changing the Text of a Text UI object with playmaker.

I don't see any UI actions in playmaker to do so, and when I follow the instructions to add the proxy to my text object, it just says "UI target is not a valid UI Component"

It truly can't be this hard to just update the text on a text object, can it?  :)
« Last Edit: March 08, 2015, 03:30:42 AM by ArcadEd »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: UI and GUI big problems
« Reply #5 on: March 08, 2015, 04:21:20 AM »
Hi,

 It's explained in the following screencast


Also, if you have the Ecosystem, you'll find a dedicated action to set a uGUI text.

 search for "ugui", and you'll get a list of all the actions, packages and samples available. locate the "u Gui Set Text" item and mouse over it, then click "get", it will install that action on your project, ready to be used in playmaker.

 Let me know how it goes.

 Bye,

 Jean

ArcadEd

  • Playmaker Newbie
  • *
  • Posts: 2
Re: UI and GUI big problems
« Reply #6 on: March 08, 2015, 11:02:47 AM »
That helped a great deal, thank you.

snortch

  • Playmaker Newbie
  • *
  • Posts: 31
Re: UI and GUI big problems[SOLVED]
« Reply #7 on: June 15, 2015, 08:28:04 AM »
Helped me too. Thank you Jean :)

snortch

  • Playmaker Newbie
  • *
  • Posts: 31
Re: UI and GUI big problems[SOLVED]
« Reply #8 on: June 15, 2015, 05:01:29 PM »
I spoke too soon. Jean's video didnt quite explain what I was trying to do, but it did help me to get unstuck.

I'm going through Brandon Wu's tutorial (http://www.onemonthgameschool.com/classes/) and I was stuck trying to figure out how to get a piece of UI text to update each time the Kenney character collided with a coin sprite.

I was able to get the text to update. Here's how:

http://www.screencast.com/t/qOQhJ0kPVx2N