MissingReferenceException at scene unload time

I want to store my data when current running scene was unloaded. For this purpose I have written following code:

 void OnDisable ()
     {
         BackUpPuzzleData();
     }

     public void BackUpPuzzleData ()
     {
         if (DataStorage.RetrievePuzzleStatus (difficultyLevel, puzzleId) == Constants.PUZZLE_NOT_OPENED
             && DataStorage.RetrievePuzzleStatus (difficultyLevel, puzzleId) != Constants.PUZZLE_COMPLETED)
             DataStorage.StorePuzzleStatus (difficultyLevel, puzzleId, Constants.PUZZLE_RUNNING);

         if (DataStorage.RetrievePuzzleStatus (difficultyLevel, puzzleId) == Constants.PUZZLE_RUNNING)
             StorePuzzleData ();
     }


     private void StorePuzzleData ()
     {
         DataStorage.StorePuzzleTimePassed (difficultyLevel, puzzleId, GameController.gamePlayTime);

         foreach (Transform cell in gridTransform) {
             CellInformation cellInfo = cell.GetComponent<CellInformation> ();
             if (cellInfo != null) {
                 CellStorage.StorePuzzleCellNumber (difficultyLevel, puzzleId, cellInfo.RowIndex, cellInfo.ColIndex, cellInfo.number);
                 CellStorage.StorePuzzleCellColor (difficultyLevel, puzzleId, cellInfo.RowIndex, cellInfo.ColIndex, cellInfo.CellColor);
                 CellStorage.StorePuzzleCellDisplayColor (difficultyLevel, puzzleId, cellInfo.RowIndex, cellInfo.ColIndex, cellInfo.CellDisplayColor);
             }
         }
     }

But when OnDisable method gets called at that time Console giving me following error:

I have already set execution order of scrip in project settings then why I am getting this kind of error?

EDIT: Basically I want to save current game play data so when game player return back he can again start from which he left game.

Which line is the fault being traced back to? It’s unclear because we don’t have your actual line numbers.

by virtue of the only Transform type attempt being on line 21, I’m going to guess its there. I.e. getting the transform children of “gridTransform”.

However the question appears to be more about the timing of the OnDisable call vs the destruction of everything in the scene having called for the scene to be “unloaded”.

edit: having said that, does anything else attempt to do anything with “gridTransform” or it’s children that might cause them to be destroyed? i.e. other OnDisable/OnDestroy functions that might be called ahead of this one and the scene unloading is a red herring?

Yes my transform statement in above source code causing this error. I think there is no need of line number here because by reading error, it was very much clear.

Yes all other game objects are destroyed before I call them in for back up purpose. Basically my goal is to store all grid cells data. So OnDisable method I have written this code but actual cell objects are destroyed before I manage to store their data.