playMaker

Author Topic: Working With Global Variables Crashes Unity[SOLVED]  (Read 2268 times)

ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
Working With Global Variables Crashes Unity[SOLVED]
« on: February 04, 2014, 02:01:50 AM »
Hi,

I have a Global Variable that I test with Bool Test(also tried with Int Switch), and whenever I press play, it crashes Unity.
I've attached a screenshot of the FSM.(In the screenshot I use Jean's FSM Bool Test, but it has the same Issue as Bool Test and Int Switch).

I don't know if this is a bug or I'm doing something wrong. Can somebody help me with this?
« Last Edit: February 04, 2014, 06:49:05 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Working With Global Variables Crashes Unity
« Reply #1 on: February 04, 2014, 04:49:32 AM »
Hi,

 you may have a logical clash leading to a crash. For example your two states could keep calling each other indefinitly. Sometimes PlayMaker will catch this and fire an error, but it may be a case where Unity crashes before PlayMaker can catch that issue.

So, study your logic, and remove actions until you reach a stable system, then you can work it back again, taking care of implementing a logical system.

bye,

 Jean

ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Working With Global Variables Crashes Unity
« Reply #2 on: February 04, 2014, 05:35:05 AM »
Hi Jean,

The two states were meant to call each other, like a loop, because I need them to do something every second(there is a wait Action set in one of them).

When I remove the two Events that you see in both of them, and replace them with the FINISHED event, they call each other every second WITHOUT crash.

The crash only occurs when I put in these two events, and the Bool Test Action.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Working With Global Variables Crashes Unity
« Reply #3 on: February 04, 2014, 06:03:12 AM »
Hi,

 yep, so you need to find another way.

 what are you tryign to achieve?

bye,

 Jean

ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Working With Global Variables Crashes Unity
« Reply #4 on: February 04, 2014, 06:14:56 AM »

Simply put, there's an amount subtracted from an other amount every second, but when a "Disc" is pressed in-game, that amount gets subtracted 10 times per second, when disc is released, it goes back to normal.
With the first State, I'm calculating the amounts.
With the second State, I'm displaying the results on screen.
Both states have Bool Test action that checks if "Disc" is pressed or not. If it's pressed they go to a 3rd State, which multiplies the amount needed to be subtracted, subtracts it, then goes to 2nd State, to display the results.


ColeBK

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Working With Global Variables Crashes Unity
« Reply #5 on: February 04, 2014, 06:27:18 AM »
I solved it:
I've put the FSM Bool Test in a separate State, and now it works.
Looks like it collided with the Wait Action.