Hi,
So I have ES3 enabled on a prefab it saves fine. But I instantiate two of these prefab. One will be the original and the other will be the copy. I want to disable saving on the copy and only save the original. I tried removing ES3Prefab component on the copy but it still gets saved.
Disable Saving on Prefab instance?
Re: Disable Saving on Prefab instance?
Hi there,
How are you saving and loading your data?
All the best,
Joel
How are you saving and loading your data?
All the best,
Joel
-
- Posts: 7
- Joined: Tue Mar 22, 2022 9:17 am
Re: Disable Saving on Prefab instance?
Sorry, I was unclear with my question Are you using code, or Auto Save, or Visual Scripting (PlayMaker, Bolt, Unity VS)?
If you're using code, please could you post the code you're using to save and load?
All the best,
Joel
If you're using code, please could you post the code you're using to save and load?
All the best,
Joel
-
- Posts: 7
- Joined: Tue Mar 22, 2022 9:17 am
Re: Disable Saving on Prefab instance?
Hi,
I'm using code.
SavingManager.cs
Code: Select all
private void SavePotioneers()
{
GameObject[] potioneers = GameObject.FindGameObjectsWithTag("Potioneers");
ES3.Save(_potioneersKey, potioneers);
}
private void OnApplicationQuit()
{
SavePotioneers();
}
Code: Select all
private void Start()
{
LoadPotioneers();
}
private void LoadPotioneers()
{
if (ES3.KeyExists(_potioneersKey))
{
ES3.Load(_potioneersKey);
}
}
Instantiang the original and copy of the prefab:
Code: Select all
private void CreateCopyAndOriginal()
{
GameObject orignal = Instantiate(GameManager.Instance.NPCManager.PotioneerList[i].potioneer);
GameObject instantiateCopy = Instantiate(GameManager.Instance.NPCManager.PotioneerList[i].potioneer);
Destroy(instantiateCopy.GetComponent<ES3Prefab>());
}
Re: Disable Saving on Prefab instance?
Hi there,
The GameObject is being saved because it's in the array that you're telling Easy Save to save. If you don't want to save that GameObject you should remove it from the array you're saving.
All the best,
Joel
The GameObject is being saved because it's in the array that you're telling Easy Save to save. If you don't want to save that GameObject you should remove it from the array you're saving.
All the best,
Joel
-
- Posts: 7
- Joined: Tue Mar 22, 2022 9:17 am
Re: Disable Saving on Prefab instance?
Thank you! You are a life saver. I did not notice that xD