GameObjects created from prefabs - members reverting on play.

Hello, I’ve set up a prefab and scattered a few instances of it around a level - but changed some of the members per instance. When starting the game, all members revert back to what were set on the prefab. Has anyone encountered this before? The values are changed before the first frame of started (verified by breaking in Start).

To give an idea of the setup, there is a VectorFieldAffector component (which is on the gameobject I am making the prefab for), which contains a VectorFieldForce. VectorFieldForce contains the members - all marked with [SerializeField], and the class as [Serializable].


You must set those values in inspector before even hitting play button. Every change while game is running is reverted to state of saved scene while you stop game.

Can you provide whole class code ? Are u setting those values anywhere in the code ? Are u accessing those fields in the code directly or through property / setter getter ? (you should use setters and getters even if your field is public for inspector)
If you do so, then add debug log in setter, to check if setter resets your values, or if thats something else. If you are accessing fields directly, then consider refactoring.