RedditPP Mascot

RedditPP

r/unity • … • u/avah_crowe

so I'm back with another scriptable object issue. they are acting on scripts even when my game isn't running

so I'm making an RPG with multiple characters. I have a database SO, which is filled with character sheet SOs, and those character sheets have all the an array of equipment SOs and a second similar array for the equipment they start with. the idea being that the first array is the one used in game and when you start the game up or dye and reset, the second array is used to reset it.

to that end I have a for each loop in the title screen that goes through the database and does a "c.equipment = c.startingEquipment;" in the start method. now I think what I've effectively done here is tell unity that the 2 arrays are the same and should be linked, but even after i stop running the game the arrays stay linked like that, with starting equipment constantly overwriting the equipment array.

I seam to have fixed it by splitting the code so it sets each position of the equipment array separately. but I would still like to know if this is normal and due to me messing up , or is it some kind of bug. i get why it would happen during runtime, but i would have thought once it stopped it would revert ?

Edit: think we worked it out

— 0