playMaker

Author Topic: (SOLVED) Using Array to get closest gameObject not working in Build  (Read 1817 times)

Chi

  • Playmaker Newbie
  • *
  • Posts: 7
Hi,

I've tried all the available 'get closest from array' actions and modded 'get closest by tag' to use an array (I don't need visible or sight tests), but although they all work great in Editor, all return null in a build on 2019.3/4 and 2020.1b.
'Get closest by tag' works fine in a build but I'd much rather be efficient and use an array.

Should I be using ArrayMaker rather than the inbuilt fsmArrays when dealing with gameObjects?

Helps please!

Chi
« Last Edit: July 07, 2020, 09:18:15 AM by Chi »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Using Array to get closest gameObject not working in Build
« Reply #1 on: June 12, 2020, 02:23:24 AM »
Hi,

 I am confused, you seem to say you have made some custom actions yourself for this.

 are they the one not working? or is it the original custom actions that do not work.

arraymaker and fsmarray will be ruffly the same, FsmArray will have an edge in terms of performance if you have hundreds or thousands of gameobject references, if you have a dozen, you won't see any difference in terms of perfs.

Bye,

 Jean

Chi

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Using Array to get closest gameObject not working in Build
« Reply #2 on: June 12, 2020, 08:46:06 AM »
Hi,

Both. Any action that returns a gameObject from an fsmArray based on distance will work in editor but fails and returns null in a build using 2019.3, 2019.4, 2020.1b.

Chi


Chi

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Using Array to get closest gameObject not working in Build
« Reply #3 on: June 12, 2020, 09:32:14 AM »
Hi,

Just to be super clear, attached is an action that will work in Editor but will not work in a Build (win X86_64).

Chi

Chi

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Using Array to get closest gameObject not working in Build
« Reply #4 on: June 13, 2020, 06:54:50 AM »
Hi,

After more testing I think I've narrowed down the issue;

It appears that

foreach(GameObject _go in array.objectReferences)

only executes if the Array has been filled before game start (I.E. manually in Editor)

Filling an empty Array of any size in game results in a null return, so I assume the foreach loop never executes.

All other Array returns such as getNextItem execute properly as they use different methods to cycle through the Array.

Chi


Chi

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Using Array to get closest gameObject not working in Build
« Reply #5 on: June 26, 2020, 05:03:07 AM »
Any help would be appreciated.

Chi

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Using Array to get closest gameObject not working in Build
« Reply #6 on: July 01, 2020, 01:43:37 AM »
Hi,

 I think you should actually use the action ArraySaveChanges before you operate action on an array that you have just populated, this might be the issue here.

 Can you try that and let me know?

 unfortunatly I don't own a windows machine, so I can't really test for that, but I would assume at this point this has nothing to do with the platform.

Bye,

 Jean

Chi

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Using Array to get closest gameObject not working in Build
« Reply #7 on: July 07, 2020, 09:17:44 AM »
Hi,

 :) Yes, that solved the issue!
Thank you for the help.

Chi

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Thanks! I always forget about the need to do it.