- Home /
Question by
vontio · Jun 08, 2013 at 05:41 AM ·
scriptableobjectserialize
ScriptableObject serialize object,any work around
Hi,
I want to serialize a list of values,value could be float,vector,color,etc.
public class MyData
{
public int type;
public object value;
}
I notice ScriptableObject can not serialize object,values are always null.
The only method I know is declare all possible Types in MyData class,like
public class MyData
{
public int type;
public Vector3 vectorValue;
public Color colorValue;
public float floatValue;
//...All possible types
}
I think there should be a better way to serialize generic values.
Comment
Answer by jister · Oct 03, 2013 at 05:54 PM
[System.Serializable]
public class MyData : ScriptableObject
{
public int type;
public object value;
}
Your answer

Follow this Question
Related Questions
ScriptableObject loses data after Reload 1 Answer
How to serialize scripts in Unity? 1 Answer
Error on manually deserializing ScriptableObject 0 Answers
List of ScriptableObjects lost on project reload 1 Answer
Get Reliable Instance ID 0 Answers