playMaker

Author Topic: ArrayList Proxy Null Error  (Read 1239 times)

Athin

  • Full Member
  • ***
  • Posts: 163
ArrayList Proxy Null Error
« on: February 21, 2020, 08:29:46 AM »
Heya,

So I think I stumbled onto a bug but can't seem to track it exactly down. 

Basically I have a GO that holds an array of all the resources it needs (Construction Site) and also adds itself to the job list array on another GO(Empty Job Manager).  A third GO (Builder Unit) then checks the Job list and finds a work site.  Once found, it checks the resources needed and collects what he needs.  This all works fine until the Construction Site is destroyed.  Once a new site appears for the unit to check the resources again, this null error appears.

At first I figured it was my logic somewhere but a break point right before the Get Next action for the Missing Resource Array shows everything to be correct.  The Builder unit has the correct GO Variable, Array Reference, Reset Flag, Ect. What really makes me think its a bug is by simple deactivating the Construction site rather then destroying it fixes this issue. It's like destroying the GO causes a Ghost reference for that Get Next array to try to find

Now I've tried to Isolate this by re-creating this in a new scene but couldn't.  Has anyone else notice this happening or knows the cause that it could be?

Thanks

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: ArrayList Proxy Null Error
« Reply #1 on: February 21, 2020, 09:49:59 AM »
Hi.
If you destroy some object that is in an array it will not be removed, but will give an error as its not found any more.

Best way is just before you destroy do a 'array contains' action (store the index) and then do a 'Array Delete At' (use the index)

if you use array maker (array list) then there is an action called 'Array List Remove' which does basically the same as the 2 action above for the build in array.

if you have lots of objects adding and removing i would suggest to move over to array list.

Athin

  • Full Member
  • ***
  • Posts: 163
Re: ArrayList Proxy Null Error
« Reply #2 on: February 22, 2020, 08:47:23 PM »
Heya,

So its not the object in the array but the array itself it can't find.  Its an odd one as the code runs fine on the first pass but after it re-runs the same code looking for the new array, it throws this error as if it can't find the array. Breakpoints before the action runs shows everything is correct right before the action runs so its really confusing to what is triggering this error.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: ArrayList Proxy Null Error
« Reply #3 on: February 23, 2020, 09:14:17 AM »
Hi.
Can you show some images or video on your setup :)