Custom inspector replace array element with value from another array element

i’m trying to build a custom inspector to make life easier for customizing weapon stats in different behaviour states.

and everything’s pretty much working except a few things, i wanted to copy values of an array element to the other array elements.

when i press the “copy values to other state” button in the [BEGINNING] tab, it should replace the all the values of [HURT] with the ones from [BEGINNING], but i couldn’t wrap my head around replacing values of serialized properties.

i’ve got two for loops, am trying to replace values in “j” with values in “i”, something like this

for(int i = 0; i < statsArray.arraySize; i++)
{
	// a bunch of codes to display other serialized properties in index  "i", omitted for sanity's sake
	if(GUILayout.Button("Copy Values To Other State",GUILayout.MaxWidth(250)))
	{
		SerializedProperty tempTemplate = statsArray.GetArrayElementAtIndex(i).Copy();
		for(int j = 0; j < statsArray.arraySize; j++)
		{
			if(j != i)
			{
				statsArray.GetArrayElementAtIndex(j).objectReferenceValue = tempTemplate.objectReferenceValue; // doesn't work
				statsArray.GetArrayElementAtIndex(j) = tempTemplate; // doesn't work too
			}
		}
	}
}

i thought about using InsertArrayElementAtIndex() but afaik all this one does is just add an empty array element at the designated index.

i’m stumped now, any ideas?

heeding Baste’s advice, i did this :

if(GUILayout.Button("Copy Values To Other State",GUILayout.MaxWidth(250)))
{
	// hardcoded value of total editable variables in the class i'm editing
	int maxCount = srldScriptObj.FindProperty("mEditableVariableCount").intValue; 

	for(int j = 0; j < statsArray.arraySize; j++)
	{
		SerializedProperty fromProp = statsArray.GetArrayElementAtIndex(i).Copy();
		if(j != i)
		{
			SerializedProperty toProp = statsArray.GetArrayElementAtIndex(j);
			int counter = 0;
			while(toProp.NextVisible(true) && fromProp.NextVisible(true) && counter < maxCount)
			{
				switch(toProp.propertyType)
				{
					case SerializedPropertyType.Float:
						toProp.floatValue = fromProp.floatValue;
						break;
					case SerializedPropertyType.Integer:
						toProp.intValue = fromProp.intValue;
						break;
					case SerializedPropertyType.Boolean:
						toProp.boolValue = fromProp.boolValue;
						break;
				}
				counter++;
			}
		}
	}
}

it works fine, but this is a very brute force method to be sure. then again i’m getting tired of fencing with serializedProperty and its quirks and i’m spending way to much time on this.

i’m just going to leave this here in case anyone wants a place to start. further answers or advices will be appreciated though.