Hello, I bought easy save today and have been learning to use it.
Unfortunately the way i made the random weapon system in my game makes saving difficult even with this plugin.
ANyway, my question is how can i save some objects by reference (such as scriptable objects that represent the base weapons) and other objects by their value (the generated scriptable objects that i deconstruct on saving and reconstruct on loading)?
I want to specifically save the random values like damage) by value in that generated SO, but i want to save the unchanging SOs that represent it, such as the base stat types and base weapon.
Save some things by ref and others by val
Re: Save some things by ref and others by val
Hi there,
You can do this by creating an ES3Type file and modify it as described here:
https://docs.moodkie.com/easy-save-3/es ... g-es3types
And then you can use the third parameter of the writer.WriteProperty method to choose how it is written:
// By reference
writer.WriteProperty("myProperty", instance.myProperty, ES3.ReferenceMode.ByRef);
// By reference and value
// I.e. if a reference already exists with that ID, it'll load the data into that reference.
// Otherwise, it will create a new instance and load the data into that.
writer.WriteProperty("myProperty", instance.myProperty, ES3.ReferenceMode.ByRefAndValue);[/code]
All the best,
Joel
You can do this by creating an ES3Type file and modify it as described here:
https://docs.moodkie.com/easy-save-3/es ... g-es3types
And then you can use the third parameter of the writer.WriteProperty method to choose how it is written:
Code: Select all
// By value
writer.WriteProperty("myProperty", instance.myProperty, ES3.ReferenceMode.ByValue);
writer.WriteProperty("myProperty", instance.myProperty, ES3.ReferenceMode.ByRef);
// By reference and value
// I.e. if a reference already exists with that ID, it'll load the data into that reference.
// Otherwise, it will create a new instance and load the data into that.
writer.WriteProperty("myProperty", instance.myProperty, ES3.ReferenceMode.ByRefAndValue);[/code]
All the best,
Joel
Re: Save some things by ref and others by val
still doesn't seem to be working for me, it's still saying that its trying to get a reference thats not in the manager. will have to take another look at my system, thanks for the help tho!Joel wrote: ↑Wed Dec 30, 2020 8:46 am Hi there,
You can do this by creating an ES3Type file and modify it as described here:
https://docs.moodkie.com/easy-save-3/es ... g-es3types
And then you can use the third parameter of the writer.WriteProperty method to choose how it is written:
// By referenceCode: Select all
// By value writer.WriteProperty("myProperty", instance.myProperty, ES3.ReferenceMode.ByValue);
writer.WriteProperty("myProperty", instance.myProperty, ES3.ReferenceMode.ByRef);
// By reference and value
// I.e. if a reference already exists with that ID, it'll load the data into that reference.
// Otherwise, it will create a new instance and load the data into that.
writer.WriteProperty("myProperty", instance.myProperty, ES3.ReferenceMode.ByRefAndValue);[/code]
All the best,
Joel