How do I correctly edit an object in another scene?

I am using additive scenes, then have an editor function to modify a property an another object inside a different scene.

However, it’s not saving the change when I hit play!!

Here’s the code:

            var units = GameObject.FindObjectsOfType<BaseUnit>();
            foreach ( var unit in units )
            {
                if ( unit.IsFirstPickUnit == true )
                {
                    unit.IsFirstPickUnit = false;
                    if ( !Application.isPlaying )
                        EditorSceneManager.MarkSceneDirty( unit.gameObject.scene );
                }

            }

But it doesn’t work! The scene is correctly marked dirty, but the unit’s flag is NOT changed.

So I tried this next:

            var units = GameObject.FindObjectsOfType<BaseUnit>();
            foreach ( var unit in units )
            {
                if ( unit.IsFirstPickUnit == true )
                {
                    unit.IsFirstPickUnit = false;
                    
                    var serializedObject = new UnityEditor.SerializedObject(unit);
                    var prop = serializedObject.FindProperty( "IsFirstPickUnit" );
                    prop.boolValue = false;
                    serializedObject.ApplyModifiedProperties();
                    serializedObject.SetIsDifferentCacheDirty();
                    serializedObject.Update();
                    
                    if ( !Application.isPlaying )
                        EditorSceneManager.MarkSceneDirty( unit.gameObject.scene );
                }

            }

That didn’t work either.

What am I doing wrong? It keeps leaving the flag as “true” on any object modified in another scene. (even if I hit save)

check this out :