面倒なので拡張
public static class Extends { /// <summary> /// Gets the bool array value. /// boolの配列を取得する. /// </summary> /// <returns>The bool array value.</returns> /// <param name="myProp">My property.</param> /// <param name="key">Key.</param> public static bool[] GetBoolArrayValue(this SerializedProperty myProp, string key) { SerializedProperty serializedProperty = myProp.FindPropertyRelative(key); if(serializedProperty.isArray) { bool[] boolArray = new bool[serializedProperty.arraySize]; for(int i=0; i<serializedProperty.arraySize; i++) { boolArray[i] = serializedProperty.GetArrayElementAtIndex(i).boolValue; } return boolArray; } else { return null; } } /// <summary> /// Gets the string array value. /// stringの配列を取得する. /// </summary> /// <returns>The string array value.</returns> /// <param name="myProp">My property.</param> /// <param name="key">Key.</param> public static string[] GetStringArrayValue(this SerializedProperty myProp, string key) { SerializedProperty serializedProperty = myProp.FindPropertyRelative(key); if(serializedProperty.isArray) { string[] stringArray = new string[serializedProperty.arraySize]; for(int i=0; i<serializedProperty.arraySize; i++) { stringArray[i] = serializedProperty.GetArrayElementAtIndex(i).stringValue; } return stringArray; } else { return null; } } /// <summary> /// Sets the bool array value. /// boolの配列を設定する. /// </summary> /// <param name="myProp">My property.</param> /// <param name="key">Key.</param> /// <param name="value">Value.</param> public static void SetBoolArrayValue(this SerializedProperty myProp, string key, bool[] value) { for(int i = 0; i < value.Length; i++) { myProp.FindPropertyRelative(key).InsertArrayElementAtIndex(i); myProp.FindPropertyRelative(key).GetArrayElementAtIndex (i).boolValue = value[i]; } } /// <summary> /// Sets the string array value. /// stringの配列を設定する. /// </summary> /// <param name="myProp">My property.</param> /// <param name="key">Key.</param> /// <param name="value">Value.</param> public static void SetStringArrayValue(this SerializedProperty myProp, string key, string[] value) { for(int i = 0; i < value.Length; i++) { myProp.FindPropertyRelative(key).InsertArrayElementAtIndex(i); myProp.FindPropertyRelative(key).GetArrayElementAtIndex(i).stringValue = value[i]; } } }