Here is my script from my saveableObject
enum ObjectType {Box1, Box2, Box3}
public abstract class SaveableObject : MonoBehaviour {
protected string saveStats;
[SerializeField]
private ObjectType objectType;
// Use this for initialization
private void Start () {
SaveGameManager.Instance.SaveableObjects.Add(this);
}
public virtual void Save(int id){
PlayerPrefs.SetString (Application.loadedLevel +"-"+ id.ToString(),objectType +"_"+ transform.position.ToString () +"_"+ transform.localScale +"_"+ transform.localRotation +"_"+ saveStats);
}
public virtual void Load(string[] values){
transform.localPosition = SaveGameManager.Instance.StringToVector (values[1]);
transform.localScale = SaveGameManager.Instance.StringToVector (values [2]);
transform.localRotation = SaveGameManager.Instance.StringToQuaternion (values [3]);
}
public void DestroySaveable(){
SaveGameManager.Instance.SaveableObjects.Remove (this);
Destroy (gameObject);
}
and this is my script on deleting an object
void Update(){
if(Input.GetKeyDown(KeyCode.A)){
DestroySaveable ();
}
}
Now my problem here is that when i hit a all of the objects has been destroyed. How can i possible delete only a single object from my list of saveableObject.
anyone please . I’m just new to csharp. And Sorry for my bad english