My Player object saves its velocity between game compiles, but I don't want it to.

I’ve been trying to reduce dependancies in my project through scriptable objects and what I ended up with right now is this weird problem. Whenever my scripts recompile and I run the game once, everything’s normal. But if I run the game again, the player object I’m controlling seems to be setting its velocity as the last velocity it had in the last run, from what I’ve gathered. I don’t think I store that velocity anywhere, when the game starts the InAir state the object is in starts constantly updating rigidbody’s velocity by adding X input to it, but it worked normally before, I don’t understand why it started behaving this way suddenly. The biggest change I did today was move the state the player can enter from code to scriptable objects, but none of them store the object’s velocity.

I realize that this issue is very specific to my own code, but I"ve been trying to fix this for hours and can’t seem to find the reason, so this forum is my last resort at the moment. Maybe someone had a similar problem before?

on startup you should create a instance of your scriptable object, then you can do any modifications you need that should not survive exiting play mode in the instance of the SO

But how would it be accessed by other objects without direct links? Doesn’t that just make it equivalent to a regular MonoBehavior and defeat the whole purpouse of ScriptableObjects?

One feature of scriptable objects is that their values are persistent between play mode runs. And unless you initiate a recompile, even non-serialised values will be maintained.

Just give your SO a Reset() method which is called by one of more of the monobehaviours that are referencing it, called by their OnDisable/OnDestroy callbacks.