Is it possible that variable value is saved between Play Modes without me knowing?

Hi, I have problem with my script that is storing amount of currency (currency is dropped when enemy is killed). Method changeQuantity() is called from script attached to Player when enemy is killed and is incremented by one.

The problem is that it seems like the script is somehow “carrying” essenceQuantity from previous Play Mode. For example, when I enter Play Mode and kill one enemy, the essenceQuantity = 1. When I exit and enter Play Mode again, after killing one enemy, the essenceQuantity = 2 and so on.
180586-vystrizek.png
180587-vystrizek1.png
Screens were taken in two Play Modes after killing one enemy.

public class Blood_Essence_Quantity_Script : MonoBehaviour
{
    private int essenceQuantity;

    void Awake()
    {
        essenceQuantity = 0;
        Debug.Log("Quantity after Awake = " + essenceQuantity);
        gameObject.GetComponent<Text>().text = essenceQuantity.ToString();
    }

    public void changeQuantity(int quantityDiference)
    {
        Debug.Log(quantityDiference);
        essenceQuantity = essenceQuantity + quantityDiference;
        Debug.Log("Quantity after killing enemy = " + essenceQuantity);
        gameObject.GetComponent<Text>().text = essenceQuantity.ToString();
    }
}

Yes they are using two method to save data in online and offline without knowing…

  1. Integrated unity saving system provided by unityClick for view video
  2. You are used the C# Programble method linkClick View video

To crack this elusive mystery-case, replace:

private int essenceQuantity;

with:

int __essenceQuantity = 0;// don't touch this;
int essenceQuantity
{
	get
	{
		Debug.Log($"{nameof(essenceQuantity)}.get called, value: {__essenceQuantity}",gameObject);
		return __essenceQuantity;
	}
	set
	{
		// read message callstack for details
		Debug.Log($"<b>{nameof(essenceQuantity)}.set called, new value: {value}</b>",gameObject);
		__essenceQuantity = value;
	}
}

My bet is on this component being disabled, so Awake is never called. Second piece of the puzzle, logs, will tell the rest of the story.
_

TL;DR: This component was part of a prefab asset and not a scene gameObject so it’s fields never resets.