playMaker

Author Topic: ArrayMaker (?) crashes Unity[SOLVED]  (Read 2944 times)

Mayhem

  • Full Member
  • ***
  • Posts: 171
ArrayMaker (?) crashes Unity[SOLVED]
« on: March 15, 2013, 08:01:39 AM »
Hey there,

i after many thoughts i looked into the ArrayMaker in order to make a better approach to the Inventory-System in my Game. I tried something out, which worked fine, but now i have a serious problem. At a certain point something within the FSM crashes Unity, which is very very annoying.

So, first, my Setup:

I have this 2x2 Grid Spriteobject:



In the Center of each Gridfields, there are empty GameObjects called SLOT1-4.
Each SLOT-Object has an PlayMaker ArrayList-Proxy attached.
The Prefill Type is "String".

What do i want to do? It's quite simple. Every time the Player want's to pick up an Item (these Spriteobjects have an BoxCollider attached, as a Trigger!), it will send an Event to the First Slot:



The SLOT-FSM looks like this:



So, the very first thing i do is asking if the ArrayList already contains an Item:


If it has no Item in the List, i move on to the next State Adding the Item to the List:



Then in the next State i create the Object out of the Prefab:


Setting the SLOT1 as a Parent and make the Object PixelPerfect.

If it HAS AN Item in the List, i send an Event called "SLOT2" to the second Slot. There, it's basically the same procedure. I ask if the List contains already an Item, if not, i add it, create the item etc., if yes, i send an even to the next Slot and so on.


If you look at this picture again:



If I make a Transition "FINISHED" at State6 and direct it to the "ITEMTRIGGER"-State, the Game breaks when the Character moves into a TriggerCollider and Unity Crashes.

If i don't do that, it works till i pick up the second Item (Remember, every Item sends an "ITEMTRIGGER"-Event to the first Slot).

I was sitting the whole night at this problem and can't think clearly anymore, i would really appreaciate some help on this. So, thanks in advance! :)
« Last Edit: March 15, 2013, 09:14:43 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker (?) crashes Unity
« Reply #1 on: March 15, 2013, 09:01:47 AM »
Hi,

 Could you send me that project? I will look at it and if I can repro, I will tell you where it come from, and if it's something within arrayMaker, I'll fix it.

 I never had any crashes when using arrayMaker, so I suspect ( hopefully) that it's more something to do with your physics set up or a bad loop or something.


bye,

 Jean

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: ArrayMaker (?) crashes Unity
« Reply #2 on: March 15, 2013, 09:11:31 AM »
You got it. I just found the solution, it was a bad loop, indeed! :D

It was my State 3-Transition.  When i was asking if YES or NO, and if the case was YES i send an Event to the second Slot, but when it "FINISHED" i directed it back to the First State, which made an infinite loop:

First Item picked up: works
Second Item picked up: breaks, because the second time it redirects to itself, which can't work that way.

Gosh, i hate myself for that tiny mistake...anyway, thanks for the hint, Jean! Didn't thought about the possibility of an infinite loop.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker (?) crashes Unity
« Reply #3 on: March 15, 2013, 09:14:24 AM »
Hi,

 no worries, 99% of the bugs are silly mistakes... we are all in the same boat... :)

bye,

 Jean