How to prevent Prefab in SerializedField from being premanently changed by script even after play mode was exited

I apologize in advance if this question is hard to understand or has been answered somewhere already. I find it to be a bit difficult to articulate and I couldn’t find anything helpful on the forums.

I have a Prefab with a script of mine attached in a serialized Field of another script. The first script is called EventCardAttributes and the second is called EventDeckHandler. In EventDeckHandler I use the attached (attached by drag and dropping a Prefab with EventCardAttributes in the inspector of EventDeckHandler) EventCardAttributes component to fill an array of type EventCardAttributes. The problem is when I edit a variable called quantity in the EventCardAttributes component in the array in EventDeckHandler. When I edit quantity in the array the original Prefab that i used with the EventCardAttributes script attached is changed. I do not want this to happen. What I want to happen is when I edit the EventCardAttributes component in the array that the prefab does not change. The change to the Prefab persist even after exiting play mode by the way.
I can provide more description and pictures in case some key detail is missing.

Thank you in advance for any kind of help.

I would upload images describing the problem but when I try it gives me the error “Error parsing the uploaded file.”


The problem is that you are changing the prefab itself not its instance (its probably what you want). What you want is to drag your prefab into a scene, thus creating its instance which can be edited independently of prefab. Then this created instance you can drag to a field in EventDeckHandler.