How to check for number of AActors within a SpawnVolume?
I have created a Object Spawner in C++.
The problem is however it infinitely spawns objects of subclass of type AActor. The logic that I am trying to implement is that if there is less than property of maxObjects then it will spawn up until this number.
Here is a snippet of the code however it doesn't seem to work. http://i.imgur.com/B4veHnH.png
Apologies if this is an obvious question. I have been stuck on this for several days and I cannot seem to get it working.
I have a blueprint version of the spawner which works fine but I am being marked on my C++ implementation.
Kind Regards and Many Thanks
asked Mar 06 '17 at 01:32 PM in C++ Programming
That code seems fine to me, but perhaps GameplayStatics isn't returning what you think it is? Have you placed a breakpoint and seen how many entries its returning?
Another solution you could do is just manage that list yourself.
answered Mar 06 '17 at 03:10 PM
I don't think the problem you're having is in the code snippet you posted. I just tried this (with the obvious header and the latest build from master, but that should not matter):
and it works as expected:
(You need to initialize the
There are two places where I would start looking for the error:
answered Mar 06 '17 at 03:30 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here