Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: Fat Pug Studio on March 16, 2019, 06:46:19 PM

Title: Set string value does not set value of the global variable
Post by: Fat Pug Studio 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
Title: Re: Set string value does not set value of the global variable
Post by: Fat Pug Studio on March 17, 2019, 06:18:39 AM
Oh, here's the debug.

(https://i.postimg.cc/rsrFpR5V/screenshot-243.png)

(https://i.postimg.cc/t7GRnRzh/screenshot-244.png)

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

(https://i.postimg.cc/QCynxScP/screenshot-245.png)

I'm confused.
Title: Re: Set string value does not set value of the global variable
Post by: Fat Pug Studio 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?
Title: Re: Set string value does not set value of the global variable
Post by: 600 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.
Title: Re: Set string value does not set value of the global variable
Post by: djaydino 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?
Title: Re: Set string value does not set value of the global variable
Post by: Alex Chouls 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”
Title: Re: Set string value does not set value of the global variable
Post by: 600 on March 19, 2019, 12:52:23 PM
Thanks, good to know, since then I avoid having same name local and global variables :)
Title: Re: Set string value does not set value of the global variable
Post by: Fat Pug Studio on March 24, 2019, 04:05:02 PM
That really sucks, but it's good to know.
Title: Re: Set string value does not set value of the global variable
Post by: Alex Chouls on March 24, 2019, 05:39:19 PM
I'll look into fixing this in the next update...