playMaker

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

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 950
    • View Profile
    • Fat Pug Studio
Set string value does not set value of the global variable
« on: March 16, 2019, 03: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

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 950
    • View Profile
    • Fat Pug Studio
Re: Set string value does not set value of the global variable
« Reply #1 on: March 17, 2019, 03: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.

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 950
    • View Profile
    • Fat Pug Studio
Re: Set string value does not set value of the global variable
« Reply #2 on: March 17, 2019, 03: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?

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 589
    • View Profile
    • Car and Traffic Playmaker assets
Re: Set string value does not set value of the global variable
« Reply #3 on: March 18, 2019, 10:39:16 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?
Actually as you mention it, I had the same with int as well.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4114
    • View Profile
    • jinxtergames
Re: Set string value does not set value of the global variable
« Reply #4 on: March 19, 2019, 07: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: 3574
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: Set string value does not set value of the global variable
« Reply #5 on: March 19, 2019, 08: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, 10:15:36 AM by Alex Chouls »

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 589
    • View Profile
    • Car and Traffic Playmaker assets
Re: Set string value does not set value of the global variable
« Reply #6 on: March 19, 2019, 09:52:23 AM »
Thanks, good to know, since then I avoid having same name local and global variables :)

krmko

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

Alex Chouls

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