playMaker

Author Topic: Set string value does not set value of the global variable  (Read 2604 times)

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Set string value does not set value of the global variable
« on: March 16, 2019, 06:46:19 PM »
Hi guys, here's what's going on. I use Get Key Code to String to get keyboard input and store it into string. Works perfect when i store it into local variable, but whenever i try to set it into global variable it does not work.

- I tried saving it to local variable, then to global from that local variable, nothing
- I tried buidling the string from local variable into another local variable and then try setting the global variable, nothing
- Splitting everything into multiple states, nothing

No errors are being reported, it just doesn't work.

Unity 2018.3.7f, Playmaker 1.9.1b4
Available for Playmaker work

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Set string value does not set value of the global variable
« Reply #1 on: March 17, 2019, 06:18:39 AM »
Oh, here's the debug.





FireBulletButton is a GAMEOBJECT, not STRING variable. This is how it look before i enter play mode



I'm confused.
Available for Playmaker work

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Set string value does not set value of the global variable
« Reply #2 on: March 17, 2019, 06:25:49 AM »
Here's the problem, definitely a bug. I have local and global variables of the same name, FureBulletButton. Even tho i chose GLOBAL in the set string action, it was setting the Local always. How do i submit this bug?
Available for Playmaker work

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: Set string value does not set value of the global variable
« Reply #3 on: March 18, 2019, 01:39:16 PM »
Here's the problem, definitely a bug. I have local and global variables of the same name, FureBulletButton. Even tho i chose GLOBAL in the set string action, it was setting the Local always. How do i submit this bug?
Actually as you mention it, I had the same with int as well.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Set string value does not set value of the global variable
« Reply #4 on: March 19, 2019, 10:37:53 AM »
HI.
So it only happends when you have global and local with the same variable name, right?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3985
  • Official Playmaker Support
    • LinkedIn
Re: Set string value does not set value of the global variable
« Reply #5 on: March 19, 2019, 11:15:06 AM »
This one is tricky. Actions store variable names. When the FSM loads it looks first for a local variable with that name. If it doesn’t find a local variable it looks for a global variable. This is similar to c# behavior where local variables take precedence over variables with broader scope. However, the UI should tell you this in some way so you know what’s going on. E.g., an info box: local variable “x” overrides global variable “x”
« Last Edit: March 19, 2019, 01:15:36 PM by Alex Chouls »

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 713
    • Flashing Lights
Re: Set string value does not set value of the global variable
« Reply #6 on: March 19, 2019, 12:52:23 PM »
Thanks, good to know, since then I avoid having same name local and global variables :)

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Set string value does not set value of the global variable
« Reply #7 on: March 24, 2019, 04:05:02 PM »
That really sucks, but it's good to know.
Available for Playmaker work

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3985
  • Official Playmaker Support
    • LinkedIn
Re: Set string value does not set value of the global variable
« Reply #8 on: March 24, 2019, 05:39:19 PM »
I'll look into fixing this in the next update...