Custom Editor + Array = A Long Nightmare !

Ok i know that question has been asked many times but im searching the internet and Unity answers/forums for hours and couldn’t find a single solution.(Or i am frustrated and couldn’t see what was in front of my eyes,i’m not sure:) )

I’m trying to create an Editor script which will read a sheet and assign it into and array inside the gameObject which is the script is attached.Everything is perfect until here.

But im having trouble assigning that array to the actual script.

I have tried following :

_script = (TextureAtlasReader)target;
//FYI : method below returns a Vector2[][]
_script.frames = CacheAnimation();
EditorUtility.SetDirty(target);
serializedObject.ApplyModifiedProperties();

and this (i was very hopeless and gave it a try :D)

Vector2[][] tempArray = CacheAnimation();
for (int i = 0; i < frames.arraySize; i++)
{
    for (int j = 0; j < frames.GetArrayElementAtIndex(i).arraySize; j++)
    {
        frames.GetArrayElementAtIndex(i).vector2Value = tempArray*[j];*

}
}
Any help would be great.
Summary
class X has a Vector2[][] array.
XEditor custom editor have to modify/create this array.

I found the solution for all those who is searching for similiar issues.

My issue was i was setting the target array when a GUi layout button was pressed.So i think when pressed play it was making another pass before playing and that was resetting the array to its default state.So what i did is moved my array code out of button function.