Hi,
I spawn “Balloons” in my map. Balloons belongs to a class that keeps a count of how many of them are in the level through a static variable:
in the header file:
class BALLOONGAME_API ABalloon : public AActor
{
ABalloon();
~ABalloon();
static int ballooncount;
}
in the source file:
#include "Balloon.h"
ABalloon::ballooncount = 0;
ABalloon::ABalloon() : Super()
{
ABalloon::ballooncount++;
}
ABalloon::~ABalloon()
{
ABalloon::ballooncount--;
this->Destroy();
}
Everything works fine the first time I launch my level, either through “Play In Editor” or “Simulate in Editor”. But if I stop and then try to either PiE or SiE again, my static variable ballooncount doesn’t get initialized back to zero. How can I make sure that happens, and that it happens at the right time? (ie. before spawning the balloon, before their count begins)
Thanks!
f