My main inquiry is at the bottom. EasySave has been making development much easier but I'm currently running into this warning about references not being found. I technically already have the problem solved which turned out to be me needing to add my references to the manager. I can't find the post that mentioned this anymore but the issue may be because the reference is too deep even though it's referenced in the EquipmentManager component. I seem to be able to save and load completely fine initially but when I reload the scene or exit and enter play mode again, the loading results in the warning and a null reference being returned, unless I have already added my EquipmentData reference to the ES3 manager.
These are small bits of the main classes. Use is an abstract class inheriting scriptable object. Technically here, I will have an inventory component with items where I can 'Use' an item. The item will have a reference to an EquipUse type which will then have a reference to an EquipmentData. I feel like it should be getting referenced in the scene but maybe I'm not understanding something correctly. In case there's any relevance, I'll also mention that I create a new array that gets passed into a class called SaveData which then gets saved using ES3.
Code: Select all
public class EquipmentManager : MonoBehaviour, ISaveable
{
[SerializeField]
private List<EquipmentData> equipment = new();
// ...Equip/Unequip methods
public void Equip(EquipmentData data) { ... }
}
Code: Select all
[CreateAssetMenu(menuName = "Item System/Item")]
public class ItemData : SerializedScriptableObject
{
// ...id, name, etc
private Use[] uses;
public Use[] Uses => uses;
}
Code: Select all
[CreateAssetMenu(fileName = "Use_Equip_New", menuName = "Use Action/Item/Equip")]
public class EquipUse : Use
{
[SerializeField]
private EquipmentData equipmentData;
public override void UseEffect(MonoBehaviour user)
{
if (user.TryGetComponent<EquipmentManager>(out var manager))
manager.Equip(equipmentData);
}
}
Code: Select all
[CreateAssetMenu(fileName = "EquipmentData_New", menuName = "Item System/Item/Equipment/Equipment Data")]
public class EquipmentData : SerializedScriptableObject
{
[SerializeField]
private ItemData item;
[SerializeField]
private Dictionary<StatData, float> statBonuses = new();
[SerializeField]
private EquipmentType equipmentType;
// ...public getters
}
Thanks,
Tommy