- Home /
Is there a list of types binaryformatter can save?
Trying to brain storm the best load/save options for a large rpg - binaryformatter seems like a great option, but im wondering if it can save more than just int, float, string..
Wondering if there is an actual list of types that are safe to pass to binaryformatter?
What do you mean "safe to pass"? Any type can be serialized if marked with SerializableAttribute.
What i mean is, from my understanding, you cannot save a vector3 with binaryformatter . But you are saying binaryformatter will save any Unity type, be it a Vector3, Quaternion, or anything else? as long as i slap a [System.Serializable] over it?
Answer by Cherno · May 02, 2019 at 02:40 AM
Types in the System namespace.
sbyte
short
int
long
byte
ushort
uint
ulong
float
double
decimal
char
bool
string
Object
-- based off of the link I get this list, which does not mention anything about arrays, which I know can be saved with the binaryformatter... Can a List<> also be saved with the binaryformatter?
Thanks Cherno - this lead me to some more searching where I found all of your other posts xD
Appreciated!
Answer by Bunny83 · May 02, 2019 at 01:46 PM
The BinaryFormatter can save all types which are marked with the Serializable attribute. Unfortumately many of Unity's internal types (like Vector3) do not have this attribute.
Would you happen to know of a complete list of all types which are marked with the Serializable attribute?
Your answer
![](https://koobas.hobune.stream/wayback/20220612200546im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Save and Load in the build 0 Answers
Which types are actually serializable? Is the documentation incorrect or am I? 3 Answers
Load() not calling the the binaryformatter = file.create 0 Answers
Build not working on some saves for binary formatter but works on others 0 Answers
Save/load playerprefs 2 Answers