Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: ToxicFrog on April 23, 2021, 02:01:27 PM

Title: WEIRD: Array Get actions don't work until I move the State??
Post by: ToxicFrog on April 23, 2021, 02:01:27 PM
Hi Playmakers,

Here's a weird one.

I'm trying to get info from an Array. It wasn't working as expected, so I made a looping FSM to test some stuff.

I made an action to get Array Length, and then Array Get at Index 1.
When you watch the FSM, the variables I'm trying to get are Null.

BUT! When I click on the state and move it, suddenly the actions are working as expected.

Any idea why this would be happening?

I've attached a video to demonstrate.

Notice that the 2 variables 'AnswersCount _INT' and 'NextAnswer _STR' are empty until I physically move the state!
Title: Re: WEIRD: Array Get actions don't work until I move the State??
Post by: Weak Interactive on April 23, 2021, 02:39:27 PM
Hey,

If you're filling the array at runtime, then you're probably trying to get the info before it exists. That's the only thing that comes to mind as to why this would be happening.

The reason it works after you exit and re-enter the state is because the information is in the array at that point. That's my guess anyway.

It's kind of hard to tell from your video though. If your array is filled by default, then I'm not sure why the values would be null. If you still can't figure out what's happening, some more info would be helpful.

Good luck.
Title: Re: WEIRD: Array Get actions don't work until I move the State??
Post by: ToxicFrog on April 23, 2021, 02:44:46 PM
The Wait state you see is waiting 2 seconds for each loop. So it's not an issue with updating too early. I can also check 'Every Frame' and the same thing happens: No values until I physically move the state.
Strangest thing I've ever seen

*EDIT:
I've attached a video showing the same behavior when it's checking every frame. The values are empty until I move the State!
Title: Re: WEIRD: Array Get actions don't work until I move the State??
Post by: Weak Interactive on April 23, 2021, 04:26:43 PM
Oh, I see what you mean now. I thought you meant it only updated when exiting/entering the state.

Does it update in the Variables tab? Because if so, it's just a visual glitch and shouldn't impact any functionality. Also, you might have to expose the variable in the inspector to see it update in real time (check the input box in the variables tab).
Title: Re: WEIRD: Array Get actions don't work until I move the State??
Post by: ToxicFrog on April 23, 2021, 07:59:40 PM
There's some weird stuff going on. It's definitely not updating until I move the state. I tried EVERYTHING.

My teammate changed his API to brute force the data into Arraymaker, and now it works.

I won't mark this [SOLVED] b/c we had to work around it! But, all is well now.
Title: Re: WEIRD: Array Get actions don't work until I move the State??
Post by: djaydino on April 25, 2021, 11:02:50 AM
Hi.
Can you post the changes he did?
or the api as a package.