Check if something is present in the level?

Hi guys , I am pretty new in UE4(making my first project , if i can even call my thing project) I have a lizard in my level , which walks and basically collects coins.There is a function that spawns the coins and want to add a check , if i have collected all of the coins , spawn new ones , but i don’t know how. I know that, I must check for coins existence, something like:
check if there are coins in the level , if not , perform function “SpawnCoins” again, but …
Here is a screen shot of the function:

and the event graph:

Hi,

this sould do what you want: Get All Actors of Class

Hi Krum,

if you destroy a coin when the lizard picks it up, the coin obviously will be removed from your level. So you could check how many actors of your BP Coin Pickup class do currently exist in your level and if this value is greater than 0 then there are some coins left. The Get All Actors Of Class node is perfect for this. A BP function could look like this:

Hope this helps

Thank"s guys, will try it right now , will report what i I’ve done.

Thank"s man , I made it.After creating the function i had to make a little thing in the Event Graph also, to check every tick if there are coins left , which took me some time to do , but I did it.Thank"s a lot or the help, would never be able to do that on my own.

Glad that I could help. Actually, you could call the check function every time a coin gets destroyed (so I guess every time your lizard collects a coin). That way the function does not get called every Tick (millisecond or so) which can be kind off heavy for larger functions. But I don’t know your setup/game so it’s just FYI :wink:

I thought that it"s not good to call it every Tick, neither , but since i am knew will leave like that for now , maybe will changed it latter.And something funny , and first try i connected the True part of the Branch to the Spawn coins and i was spawning coins every tick :smiley: , got heavy pretty quickly.

Did it a couple of times , already …

haha can imagine that :slight_smile: please accept my answer again, somehow it isn’t accepted anymore…