Game Development Reference
In-Depth Information
void Update()
{
if(Input.GetKeyUp(KeyCode.F1))
{
Camera.main.SendMessage("SaveEnemies");
}
if(Input.GetKeyUp(KeyCode.F2))
{
Camera.main.SendMessage("LoadEnemies");
}
}
When the player presses the
F1
key, we call the
SaveEnemies
function from the
XML save system. If the player presses the
F2
key, we call the
LoadEnemies
func-
tion from the XML save system. With this functionality, the players can save their
progress at any time.