playMaker

Author Topic: Add value to a text after a collision  (Read 3901 times)

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Add value to a text after a collision
« on: October 16, 2015, 10:49:42 AM »
Hello guys,

For my game, when my gameobject have a collision, i want to increase the value of a text (it start at 940, and i want to had 50 for each collision).

I had some ideas, but none of these worked.

Is it possible to do that?

Thanks :)
« Last Edit: October 22, 2015, 12:02:01 PM by merde10 »

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Re: Add value to a text after a collision
« Reply #1 on: October 31, 2015, 02:36:05 PM »
no help? :(

KellyRay

  • Full Member
  • ***
  • Posts: 170
Re: Add value to a text after a collision
« Reply #2 on: October 31, 2015, 05:34:01 PM »
Just want to make sure I understand.

You have a string value of like 940 that you are displaying? And you want to add 50 each time a collision happens?

The best way that I can think to accomplish this is to use three values and three actions.

You'll have an integer of 940. An additional integer of 50. And a string value that you will use to display the text.

So, when the collision happens, you will send an event to a state that adds 50 to your 940 int. And then use an int to string action to convert that variable to a string which you can display as text.


mikejkelley

  • Full Member
  • ***
  • Posts: 136
Re: Add value to a text after a collision
« Reply #3 on: October 31, 2015, 07:41:00 PM »
^This. Convert Int to String is the name of the action.

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Re: Add value to a text after a collision
« Reply #4 on: November 05, 2015, 02:55:01 PM »
Thanks for you reply,

So When the player have a collision, it sends an event for adding some weight. (with int variables and a string variable for the text).

The problem is that nothing shows up in the GUI text, i wrote something on it and i can see it, but when i write nothing, the sting variable don't appear.

Why's that?

Thanks :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Add value to a text after a collision
« Reply #5 on: November 05, 2015, 03:08:46 PM »
Hi,
you need to put he "Convert Int to String" above the "Set GUI Text"
and you need to set the string Variable in your "Set GUI Text" on the Text Line.

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Re: Add value to a text after a collision
« Reply #6 on: November 05, 2015, 04:31:40 PM »
Hi,

it still doesn't show anything, i write "test" in the text GUI, so it's not the position of the GUI Text, maybe i miss something but i don't know what is it...

(When i run the game, it shows that the int variable works when they are collisions).

Do i need to add a FSM for the GUI Text?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Add value to a text after a collision
« Reply #7 on: November 06, 2015, 02:20:48 AM »
Hi,
turn off "every frame" on the convert action.

the way it is set up now it will keep on converting every frame and will not continue to your next action unless it is also checked as "every frame" then both will do what they do every frame.

but in your case i think you only need to do it once so make sure every frame is off on both actions

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Re: Add value to a text after a collision
« Reply #8 on: November 06, 2015, 10:04:43 AM »
Hi,

i turn off "every frame" on both actions, and nothing shows up (the GUI Text is still empty).

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Add value to a text after a collision
« Reply #9 on: November 06, 2015, 03:22:33 PM »
Hi,
are you using the ugui text? (inside canvas)

if so you need to get the ugui proxy full on the EcoSystem
and use the "ugui text set text" action

the gui Text is for the older (Unity3D pre 4.6) gui system.

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Re: Add value to a text after a collision
« Reply #10 on: November 10, 2015, 12:04:08 PM »
After i get ugui proxy full from ecosystem,

i have this error:

"error CS1061: Type `UnityEngine.EventSystems.RaycastResult' does not contain a definition for `worldNormal' and no extension method `worldNormal' of type `UnityEngine.EventSystems.RaycastResult' could be found (are you missing a using directive or an assembly reference?)"

i can't use playmaker anymore with this error.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Add value to a text after a collision
« Reply #11 on: November 10, 2015, 03:32:12 PM »
Hi,
are you on a unity version below 4.6.8?

in this topic they confirmed that this was fixed on 4.6.8

to get playmaker to work again you can remove the "PlayMaker uGui" folder and inside the "PlayMaker Custom Actions" folder you can also remove the "uGui" folder

if you are on unity 4.6.8 or higher try to install it again.

merde10

  • Playmaker Newbie
  • *
  • Posts: 46
  • new user of playmaker :)
Re: Add value to a text after a collision
« Reply #12 on: November 17, 2015, 11:28:48 AM »
Hi, i'm on unity 5.0.

I follow what you said, and playmaker works fine, but when i'm importing uGUI proxy, i have the same error, and i delete it again.

Is it the only way?