You can add the ES3AutoSave Component whenever you like and change what is saved in the Auto Save window whenever you like.
You can add the ES3Prefab Component whenever you like, but be aware if you make a variant it will have the same prefab ID as it's parent, so you will need to open the Advanced Settings foldout of the ES3Prefab Component and give it a unique prefab ID.
yimingt wrote: ↑Tue Nov 05, 2024 3:04 am
Would a warning appear if the prefab ID were similar to another ES3Prefab? I'm worried about duplicate Prefab IDs.
It wouldn't because there would be no way for Easy Save to know that it was a duplicate ID (otherwise we'd be able to automatically change it).
Perhaps there could be a feature for the ES3ReferenceManager to iterate through the ES3Prefab list and output those that are duplicate. Wouldn't solve in creating an ID that is unique but at least we would know of a duplication issue happening.
yimingt wrote: ↑Wed Nov 06, 2024 1:45 am
Perhaps there could be a feature for the ES3ReferenceManager to iterate through the ES3Prefab list and output those that are duplicate. Wouldn't solve in creating an ID that is unique but at least we would know of a duplication issue happening.
We wouldn't do this automatically as there are situations where it's useful to have the same prefab ID for different prefabs. However, the following Editor script should do this for the active scene:
using UnityEditor;
using UnityEngine;
public class CheckPrefabDuplicates : MonoBehaviour
{
[MenuItem("Tools/Easy Save 3/Check for duplicate prefab IDs")]
private static void Run()
{
var mgr = GameObject.Find("Easy Save 3 Manager").GetComponent<ES3ReferenceMgr>();
Debug.Log("Prefab duplicate check started");
foreach (var prefab in mgr.prefabs)
foreach(var prefab2 in mgr.prefabs)
if(prefab != prefab2 && prefab.prefabId == prefab2.prefabId)
Debug.LogWarning($"Prefab {prefab2.gameObject.name} with ID {prefab2.prefabId} has same ID as Prefab {prefab.gameObject.name}", prefab2);
Debug.Log("Prefab duplicate check finished");
}
}
situations where it's useful to have the same prefab ID for different prefabs
That's interesting. When would doing such a thing be useful? Wouldn't having the same ID potentially cause it to spawn the undesired prefab?
The most common situation is when you need to save a prefab instance, but this prefab needs to be different in different scenes. And then there's a less common situation during development where you might not have decided on which prefab you will be using for the release so you will have multiple candidate prefabs which need to have the same ID as you're bundling save data with the build (this relies on ordering the prefab list).