Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: RobotGoggles on March 07, 2021, 11:46:55 PM

Title: How to get the count of a given object in an array
Post by: RobotGoggles on March 07, 2021, 11:46:55 PM
I have an array that lists all of the summoned units a player has in their control. I'm trying to get the number of instances of a specific kind of unit and can't seem to figure it out.

I tried using ArrayMaker and the "Array List Contains Count" action, but it returns nothing, but I can see that the Array is being populated with the GameObject in question. Can anyone think of an alternate solution that would work here?
Title: Re: How to get the count of a given object in an array
Post by: justifun on December 08, 2023, 06:44:20 PM
Did you ever find a solution?  I'm facing something similar...
Title: Re: How to get the count of a given object in an array
Post by: djaydino on December 09, 2023, 04:47:25 AM
well if you are look for the game object (Prefab) , it is not the same game object, it is a instance of that object so it is not the same object.

so you can for example loop thru the array and compare a 'Tag' or name