playMaker

Author Topic: Array Changed Action!  (Read 1756 times)

fish

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 18
Array Changed Action!
« on: November 01, 2018, 08:09:23 PM »
I believe it would be very beneficial to have an array changed action, especially if it can monitor the array based on the change of a specific index or the whole array. Just like the other changed action, it will call an event if the array is changed and store the results. Maybe add a call event if the specified index doesn't exist?

Is this something possible?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Array Changed Action!
« Reply #1 on: November 02, 2018, 05:03:56 PM »
Hi.
That would not be very performance efficient to do every frame i think.

It think it would be better to send an event when you change something in the array.

Then have 2 copies from the array (old / new) and compare using get next and the index value (to get the old value on the same index)

If a value has changed copy the new array to the old array and then do what you need to do when something has changed.

fish

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 18
Re: Array Changed Action!
« Reply #2 on: November 02, 2018, 06:31:11 PM »
I originally though of doing it the way you mentioned but I noticed assets that allow you to bind variables to gui and thought that would be a lot less work and headache. Then I noticed the changed actions and thought having this with arrays would be perfect.

Is using the changed actions too inefficient for managing the display of gui data?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Array Changed Action!
« Reply #3 on: November 04, 2018, 04:20:53 PM »
Hi.
On single variables its fine,
But if you would do this on large arrays and doing it every frame it would not be good for performance.