I have a problem about the SerializedProperty when is array.
i always set one value to one element of SerializedProperty (array) with GetArrayElementAtIndex().xxxValue.
but now i have some data from other list, it always a lot. so i do this way:
List<string> dataFromOther = new List<string>();
//mySerializedProperty is Array of SerializedProperty == Custom.dataList
//now i have a data List from other,i need serialize in serializedProperty.
mySerializedProperty.arraySize = dataFromOther.Count;
for (int i = 0; i < dataFromOther.Count; ++i)
{
mySerializedProperty.GetArrayElementAtIndex(i).stringValue = dataFromOther*;*
}
I traverse the dataFromOther List to assign every value to SerializedProperty every value.
As you see. it slow in my Editor. it trouble with me.
and i want to assign directly. Because is Custom is Serializableand mySerializedProperty is dataList of string.
so code like this:
List dataFromOther = new List();
custom.dataList=dataFromOther .
this look like good, but i test it, and find it not to save.And last i try to use reflection. it always not save.
i know mix the way of Editor Serialize and the way of convert to actual class to assign directly. it result always strange.
For the problem, How can i do it ? I need a fast way to assign to SerializedProperty (is array) from other array data.