playMaker

Author Topic: Find Children With Tag - Adding Missing GameObjects  (Read 361 times)

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 254
Find Children With Tag - Adding Missing GameObjects
« on: March 22, 2023, 09:06:15 PM »
I have something very weird happening:



This action looks for KeySpawners (gameobjects with the tag "KeySpawner") and when it runs it finds missing gameobjects that appear as null and adds them to the array. How is that possible?

And I know, Playmaker sometimes behaves strange when something else is not setup correctly and this might be the case here but if it is, I can't find it.

The reason why I'm saying this is because just after that state I select randomly a gameobject from that array and then I check if that gameobject is null. Even if it selects one of these missing gameobjects, the action doesn't recognize it as null and just moves on.

There's another weird thing happening in that FSM and that is if I add breakpoints, they are never recognized, as if they wouldn't exist. The console reports them, but the game doesn't pause and the FSM just keeps running.

What should I be looking for?

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 254
Re: Find Children With Tag - Adding Missing GameObjects
« Reply #1 on: March 22, 2023, 10:23:46 PM »
I tried with the other action (the one that comes with Playmaker shipped) called Find Children. And here things are even weirder. Instead of the KeySpawners it 'finds' my GameManager gameobject and puts it in the array. And well, the GameManager clearly doesn't have the KeySpawner tag...

Is there some weird cached thing going on and Playmaker gets confused because I changed the order of tags or something?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Find Children With Tag - Adding Missing GameObjects
« Reply #2 on: March 23, 2023, 09:23:10 AM »
Hi.
the Find Children with tag action is using a list, but it might be that its not clearing the list.

so the 1st time it might be correct, but the next time not anymore.

you can try if this one works better (replace the action with the one attached below)

Christoph

  • Beta Group
  • Sr. Member
  • *
  • Posts: 254
Re: Find Children With Tag - Adding Missing GameObjects
« Reply #3 on: March 23, 2023, 11:41:25 AM »
Thanks a lot for your reply. The thing actually is that afterwards it seems to work well. But the first time it completely is messed up.

And it's not that it doesn't clean the list, it's that it adds missing gameobjects. Like if they are missing, how is it possible that it finds them in the first place (and adds them to the list?).

I'll try out your action, but I went ahead and completely re-written the logic so those keyspawners add themselves to the array rather than the Manager searching for them. Thinking about it, seems to be probably the much better solution anyways.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Find Children With Tag - Adding Missing GameObjects
« Reply #4 on: March 24, 2023, 03:01:23 AM »
Hi.
Yes, it would be better for performance.