Negative int and float becomes Zero in built game!

Hi all,
I hope someone can help me.
I built a very simple pinball spelling game. Hitting coins creates points, if correct letter is chosen the points are added to the total. If an in-correct letter is chosen points are deducted. So in some scenes if there are too many mistakes the result is a negative value. The last review scene displays that value. This works fine in Unity when I play it, however when I build and test PC version the negative value changes to 0 in last review scene.
I have a script using “DontDestroyOnLoad” save value from each scene and set value in last scene.
I have tried using floats and int but both still give a 0 instead of negative value in the PC built game.
Both floats and int’s work perfectly while testing the game in Unity.
I don’t use PlayerPrefs to save values, I simply allocate a value to the int/ float.

Please advise

seeing your awake function for the script may help. the zero value would seem to imply something is not right, the script may be new version each scene. How to not duplicate game objects on DontDestroyOnLoad? - Questions & Answers - Unity Discussions

as a test set the default value of the variable in the script between scenes to something like -420. if the last scene shows -420, then you have a problem with dontdestroyonload.

Thank you for the reply. I tried that, the dontdestroyonload was okay. I did notice that although my game played okay I missed an error report in the console about a sprite and the layer setting. Once that was corrected the values didn’t change. Still wonder why a sprite layer setting affected it, but anyway sorted now thank you very much.