Hi!
I’m having trouble understanding the logic behind the Restore State method for the Pickup Spawner.
void ISaveable.RestoreState(object state)
{
bool shouldBeCollected = (bool)state;
if (shouldBeCollected && !isCollected())
{
DestroyPickup();
}
if (!shouldBeCollected && isCollected())
{
SpawnPickup();
}
}
My problem specifically is that as far as I can tell, IsCollected is always going to return false, because RestoreState is always called after Awake, where the pickup is spawned regardless. Is there a situation that I’m not getting where this isn’t the case?