playMaker

Author Topic: Array Delete At not updating array?[SOLVED]  (Read 440 times)

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 152
    • View Profile
Array Delete At not updating array?[SOLVED]
« on: November 29, 2018, 03:27:57 PM »
I'm having a problem with the official "Array Delete At" action,  the array and the index are correct and the index is not out of range. Yet the item at the specified index is not deleted.

*Edit*

Can the official action be update with the following line to make it function please?      
array.SaveChanges();

Will submit bug report.
« Last Edit: November 30, 2018, 12:47:01 PM by LordHorusNL »

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 152
    • View Profile
Re: Array Delete At not updating array?[SOLVED]
« Reply #1 on: November 30, 2018, 12:49:20 PM »
Problem solved, turns out the action is working properly without the added code, however there is currently a display bug in Unity that doesn't show the update of the Array in the variables tab.

Thanks again Alex.

fish

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 17
    • View Profile
Re: Array Delete At not updating array?[SOLVED]
« Reply #2 on: December 19, 2018, 01:37:11 PM »
What bug is this? I need to know if it's been addressed in 2018.3. This is too annoying to just deal with.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14059
  • Official Playmaker Support
    • View Profile
Re: Array Delete At not updating array?[SOLVED]
« Reply #3 on: December 19, 2018, 11:41:42 PM »
Hi,

 Use the ArraySaveChanges action available in the Ecosystem and us it right after your action, SaveChanges is affecting performances so it's better to save changes when you need to.

Bye,

 Jean

fish

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 17
    • View Profile
Re: Array Delete At not updating array?[SOLVED]
« Reply #4 on: December 20, 2018, 12:51:36 PM »
Oh neat, I attempted to put this in a sub FSM so I could disable it globally when I didn't need it but with no luck. Fortunately, I did discover using the array delete action with an sub FSM gains the same results. Using this version of sub FSM https://hutonggames.com/playmakerforum/index.php?topic=18762.0 I was able to copy back the updated array thus giving me the visual change I wanted.

I'm not sure if the performance is better than using ArraySaveChanges, if not, then I'll just set up a global bool every time I call array delete at so I can disable it once I no longer need to check it.

Edit: Okay, I took things a step further and added a bool into the ArraySaveChange action. This bool simply by passes the save change when set to false. If you attach a global bool to this, you can control all of the actions in your project at once. Since "array delete at" works fine on the backend, you can enable this action when you need it and disable it on deployment to save performance. Or I believe that's how it'll work out. Don't quote me on this, I'm no programmer. :P
« Last Edit: December 20, 2018, 04:13:38 PM by fish »