Saving object existence
Posted: Wed Dec 18, 2019 5:35 am
Hi Joel,
I wanna save the existence of enemies. And I'm using this manual way:
I wanted to know if there's any better way to do it. Because I'm worried if the saving process makes some lags on gameplay.
I wanna save the existence of enemies. And I'm using this manual way:
Code: Select all
public bool Exist;
void Awake()
{
Exist = ES3.Load<bool>("Exist" + gameObject.name + transform.position.x.ToString(), true);
if (Exist == false)
{
Destroy(gameObject);
}
}
private void OnDestroy()
{
Exist = false;
ES3.Save<bool>("Exist" + gameObject.name + transform.position.x.ToString(), Exist);
}