To anyone that has this issue in the future, here's what I did.
Step 1: Create a custom editor tool that searches your game assets for a specific type of script. In my case, I'm searching for Items and all of their inherited classes such as ToolItems, SeedItems, etc.
Code: Select all
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(ItemDatabase))]
public class ItemDatabaseEditorExtension : Editor
{
public override void OnInspectorGUI()
{
DrawDefaultInspector();
ItemDatabase database = (ItemDatabase)target;
if(GUILayout.Button("Update Item Database"))
{
if(database.itemDatabase.Count > 0)
{
database.itemDatabase.Clear();
}
Debug.Log("Updated Item Database Database");
string[] guids;
guids = AssetDatabase.FindAssets("t:Item");
foreach (string item in guids)
{
database.itemDatabase.Add((Item)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(item), typeof(Object)));
}
}
EditorUtility.SetDirty(database);
}
}
Step 3:Right click and add this database scriptable to the ES3 reference manager.
With this, the game was able to find any of the necessary item data at runtime and load properly.
I have one last question for Joel! Is it possible to convert the ES3 reference manager into a prefab and manually handle whatever references are needed? I am primarily using the LoadInto method with most of the stuff I am saving and tend to load data directly into object scripts. The soil plots for example are saved as a list of objects in a scene. With a prefab I may be able to just work with a single master reference manager, but I'm not sure if that'll cause problems some situations.
For example: If the player is able to create more soil plots at run time, would references to these be needed if I'm already referencing it's parent list? Soil plots would be added to said list, instead of referencing the object itself?