playMaker

Author Topic: (Solved) Array Size limit performance  (Read 2278 times)

Aaddiction

  • PlayMaker2 Beta
  • Full Member
  • *
  • Posts: 171
(Solved) Array Size limit performance
« on: January 27, 2022, 09:30:59 AM »
I want to store game items in an array. When the array is up to ~200 all is good, but if I put 1000 or more the editor gets super slow. Is this only memory usage during editor mode or 1000 or more array size is not good in general for build and play performance?

I'm working in array as global variable if that is important.
« Last Edit: January 28, 2022, 06:32:29 AM by Aaddiction »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Array Size limit performance
« Reply #1 on: January 27, 2022, 09:48:15 AM »
Hi.
are you storing prefabs or items in the scene?
Also, are you using Playmakers build in array or Array Maker?

is the gameplay getting slow and/or loading (start playing)

if those are prefabs they need to be loaded even when they are not yet used.
So you might want to use resources load and only store the location where to load the prefabs (best to load @ the beginning of a scene, or during some pause in the game as it might cause some short lag)

I learned that the hard way :)
i have a enemy loading system that also had prefabs and i would create a pool only the ones i needed for a particular scene, but loading became very long until i changed the array to strings and used resources load.

also using it as a global might not be the best way.
better set a gameobject as a global (Call it Data Manager for example)
then on that object you can set Array List Proxy components (its better to use array maker's array lists or hash tables) Ecosystem

Array Lists are faster, easier to access more flexible and can be saved with easy save (action for it can be found separate on the Ecosystem)

Aaddiction

  • PlayMaker2 Beta
  • Full Member
  • *
  • Posts: 171
Re: Array Size limit performance
« Reply #2 on: January 27, 2022, 10:46:11 AM »
Hey, thanks for the answer.

1. I don't need all the items from the array in the scene, if that's the question. I only need the items stored in the array for easy access. Also, it's not just game objects for loading, I use arrays to store progress of different quests for example if they are finished - array with 1000 ints, where 1 is finished 0 is not. So to check if quest 3 is finished I go to index 3 of quest-array.

2.  Playmakers build in array. Does what I want. I'm working with Unity 2019.4, and because of some other packages cannot upgrade at the moment and when I try to load array maker it gives an error. With higher Unity version it works, but I couldn't see much difference compared to the built-in array, at least not for the purpose I use it.

3. Since I only need to load 2-3 or even 10 cars from the array with prefabs loading the objects in the scene is not taking long. I was more asking if it will affect the performance the way it's making the work in the editor slow when I create an int array with index 1000. Cannot test on build yet as the project is still very rough and even if there is performance loss I wouldn't know if it's from this 1000 index array specifically. That's why I ask in advance if somebody got that figured out yet. :)

3. I use global, because it's accessible from every FSM not only a specific FSM which is a must have in my case.

Once again to answer "is the gameplay getting slow and/or loading (start playing)" - no I just set the array to be with index of 5000 and Unity hanged so went straight away to the forum to check if I even need to bother further or stick with 99 index arrays.

Thank you for sharing your experience, I will keep try and erroring and see what happens.
« Last Edit: January 27, 2022, 10:49:10 AM by Aaddiction »

Aaddiction

  • PlayMaker2 Beta
  • Full Member
  • *
  • Posts: 171
Re: Array Size limit performance
« Reply #3 on: January 27, 2022, 11:27:16 AM »
I'm getting the following errors when trying to import Array Maker:

Assets\PlayMaker ArrayMaker\Addons\Custom\GameObject\ArrayListSendEventToGameObjects.cs(28,4): error CS0246: The type or namespace name 'NoErrorCheckAttribute' could not be found (are you missing a using directive or an assembly reference?)

Assets\PlayMaker ArrayMaker\Addons\Custom\GameObject\ArrayListSendEventToGameObjects.cs(28,4): error CS0246: The type or namespace name 'NoErrorCheck' could not be found (are you missing a using directive or an assembly reference?)

Any idea what could be the issue?

Unity 2019.4

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Array Size limit performance
« Reply #4 on: January 27, 2022, 06:43:52 PM »
Hi.
Try updating utils package (ecosystem)

if you can not access ecosystem then you can download it direct from the github page :
https://github.com/PlayMakerEcosystem/PlayMakerCustomActions_U2019/blob/master/PlayMaker/Ecosystem/Custom%20Packages/Utils/PlayMakerUtils.unitypackage

Aaddiction

  • PlayMaker2 Beta
  • Full Member
  • *
  • Posts: 171
Re: Array Size limit performance
« Reply #5 on: January 28, 2022, 06:32:05 AM »
Thank you! Editor performance is much better with Array List Proxy.