playMaker

Author Topic: Problem with GUI Elements  (Read 3682 times)

Seiryu33

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Problem with GUI Elements
« on: August 19, 2015, 01:10:30 PM »
Go I have a rather unique dilemma. I create a Currency counter using a GUI Text component and works fine until I make it a prefab and then it stops. I want it to remain constant but it resets when the scene changes and the only way to carry it over is with Prefabs. When I hit play, I set it to Maximize on play and it disappeared entirely. Has anyone else had this problem? I found no rational explanation for it, but if it happened there it would happen in the final product. What can I do to fix this problem?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4323
    • View Profile
    • jinxtergames
Re: Problem with GUI Elements
« Reply #1 on: August 19, 2015, 11:18:54 PM »
hi,
A prefab can not communicate directly with scene objects so that might be the reason, i need more info of what actions you are using

for the disappearing : Maybe when maximized it gets off screen, try testing and set it to the center of your screen
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions

Seiryu33

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Problem with GUI Elements
« Reply #2 on: August 20, 2015, 03:45:56 PM »
Here's my basic setup. Collecting a coin adds 10 points to the counter. Obviously I can't pre-animate a counter, so this is the only way to do it. I'm using a GUI Text for the counter itself. It works fine, but I'm trying to get it to remain constant so that it doesn't reset once the player leaves the scene or starts a new Stage. I basically broke the game down into different scenes.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4323
    • View Profile
    • jinxtergames
Re: Problem with GUI Elements
« Reply #3 on: August 20, 2015, 04:03:55 PM »
Hi,
you could safe you score @ end of scene and load @ start of next scene?

with playerprefs (free and build-in) or with easy save 2 (not free but with encryption)
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions

Seiryu33

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Problem with GUI Elements
« Reply #4 on: September 18, 2015, 06:27:06 PM »
This is a rather old issue, so I'll just put it here since it ties into the same problem. I've noticed that GUI Text elements don't scale to the size of the screen. I'm using GUI text for my scoring system, since I can't possibly pre-animate one. When I hit play, i have the screen set to Maximize,and the GUI text is there, no problem, but then I run a build and in the build the text isn't there anymore. After experimenting, I've noticed it doesn't stay constant to the screen, no matter what resolution you use. Is there anyway to keep GUI text from floating or disappearing off the screen? The screenshots are an example.
« Last Edit: September 18, 2015, 06:34:01 PM by Seiryu33 »

Seiryu33

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Problem with GUI Elements
« Reply #5 on: September 18, 2015, 06:50:58 PM »
Second of two

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4323
    • View Profile
    • jinxtergames
Re: Problem with GUI Elements
« Reply #6 on: September 18, 2015, 10:59:49 PM »
Hi,
what version of unity are you using?

if lower than 4.6 i suggest to upgrade (make a backup of your project folder before you do) to 4.6 or up and use ugui here is a good tutorial.
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions

Seiryu33

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Problem with GUI Elements
« Reply #7 on: September 22, 2015, 03:05:44 PM »
I'm using 5.0. I managed to partly fix the problem by running a build with the specific resolution that fits it, but that won't work if I intend to run the game on several devices with different resolutions.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4323
    • View Profile
    • jinxtergames
Re: Problem with GUI Elements
« Reply #8 on: September 22, 2015, 10:34:29 PM »
Hi,
if you want to use different resolutions you really should try ugui so you can "stick you scoreboard in the corner and automatically re sizing it depending on the resolution.
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions

Seiryu33

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Problem with GUI Elements
« Reply #9 on: October 26, 2015, 05:20:45 AM »
So I experimented with Ui on my counter and while it does scale to the size of the screen, it doesn't work with my current set up. The screenshots are my basic set up. Not much different from my previous one but how do I link this up to a Ui component?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4323
    • View Profile
    • jinxtergames
Re: Problem with GUI Elements
« Reply #10 on: October 26, 2015, 12:00:53 PM »
Hi,
You need to get the Ugui Package on the EcoSystem

if you want to use buttons you can check this tutorial :

FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions

Seiryu33

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Problem with GUI Elements
« Reply #11 on: October 29, 2015, 12:48:00 AM »
I have the most recent uGui package installed. How do I get it to update my score, like small coins being worth 10 points and so on? Apparently, to update uGui text you have to the Set Property action but I don't see the option for text. Am I missing a component?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4323
    • View Profile
    • jinxtergames
Re: Problem with GUI Elements
« Reply #12 on: October 29, 2015, 12:55:25 AM »
Hi,
if you have the ugui package you should have the action "uGui Text Set Text"
FOR HIRE:Playmaker/C#

Playmaker Samples <-------------> Easy Exporter <---------------------> TPA Actions

Seiryu33

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Problem with GUI Elements
« Reply #13 on: November 04, 2015, 10:06:15 AM »
Here's the crux of the problem I'm having with using UI components. As you can see from the screenshots, my Set Property action is only giving me a handful of options to adjust the properties for at all. It's not just UI components either. These are the only options for any object I try to use it on. Every tutorial I've seen calls for using the Set Property action, but have far more options available. Am I missing an add-on some where?