I’m writing an app that saves meals, I’m saving them in scriptable objects. if I create an instance of one, set its values then save it as an asset, then create another and it changes the values of both, it updates all the values of the scriptable objects created during that run time, ones created before (in the editor or previous times) are fine.
ingredients is a list<string>
// creats an instance of the sciptable object
items meal = (items)ScriptableObject.CreateInstance(typeof(items));
//sets its name (name of the scriptable object, not a value of it)
meal.name = mealName;
//sets the value of the Scriptable object (part that changes all Scriptable objects created during that runtime)
meal.ingredients = ingredients;
// saves the scriptable object
UnityEditor.AssetDatabase.CreateAsset(meal, (“Assets/Resources/food/”+mealName+”.asset”));`
the scriptable object:
[CreateAssetMenu(fileName = “Food Item”, menuName = “Food item”, order = 1)]
public class items : ScriptableObject
{
public List<string> ingredients;
}
ive tried changing the values after saving it, and getting a reference to the asset created after its created.