Unity Serializer won't save variable changes?

Hello guys. I’ve tried using serializer but I can’t seem to make it save the changes I make to the variables.
I declared some simple variables… This is the code:

private int x = 3;
	bool geo = true;
	Vector3 pozV3;
	Vector2 pozV2;
			
	void Start()
	{
		pozV3 = transform.position;
		pozV2 = transform.localRotation.eulerAngles;
	}

	void Update() 
	{
		print (x+" "+geo+" "+ pozV3+" "+pozV3);
		
		if(Input.GetKey(KeyCode.L))
		{
			x = 2; geo = false; 
		}
	}

When I click play it prints the default values. Then I press the L key and the values change accordingly. I save and then load… But upon loading the values are reverted back to default… What am I missing? Anyone know please?

EDIT: Ok… found out that private variables don’t get saved unless specified… but I tried a public Vector2 attached to the camera and that doesn’t seem to work…

yes a vector2 field change made in playmode will not serialize.

Somebody has made an editor extension on the asset store that facilitates serializing data while in playmode. I dont know to what extent it works or not…

Is this an issue that’s become apparent now that you serialized the data so you can modify it with a custom Inspector?

If so the issue is probably in the Inspector code; you need to tell the Editor (with EditorUtility.SetDirty) that the data on the script has changed.

[CustomEditor (typeof(UserQuizControl))]
public class UserQuizControlEditor : Editor {
	
	
	private UserQuizControl myTarget;
	private int Length = 0;

        void Awake()
	{
		myTarget = (UserQuizControl) target;
		Length = myTarget.QuizQuestions.Length;
		...
	}

public override void OnInspectorGUI() {
		
		Length = EditorGUILayout.IntField( "Size",  Length );
		EditorUtility.SetDirty(target);
}