OK - maybe I’m not understanding how prefabs work.
I was under the impression that I could Instantiate a prefab in code, and then make all sorts of wacky changes to the instance, and goof around and play with it and do whatever - meanwhile, the prefab itself would remain in tact in the project folder oblivious of what’s happening to it’s instances.
What’s actually happening, is that I’m instantiating a prefab in code, making changes to the instance fields in the code - and then the PREFAB itself is changing. Of course, the instance is being changed, as expected - but I didn’t think the prefab would change. I’m presuming that this is NOT supposed to happen because it seems like that sort of behavior would pretty much defeat the purpose of having a prefab. (Yes, I’m positive that I’m only making changes to the instance, and not the reference to the prefab itself).
So, clearly I’m doing something wrong. Is there something I’m missing to ‘lock’ a prefab into place or something of that sort?
I think this is a bit too difficult to fix without you posting some code or a scene. I have never been able to change a prefab through code unless my code is directly accessing the object in the actual folder where it is stored and modifying it there. All changes made to an instanced object in unity during runtime get wiped and are not applied to the existing prefab unless you click the “apply” button to make those changes overwrite your existing prefab. At least this has been my experience.
The only thing I can think of is that perhaps you aren’t actually instantiating a prefab, you are instantiating an object that already exists in your scene hierarchy. Changes to that object will affect all new instantiated objects if that’s what your script is pointing to as the object to instantiate. A prefab is an object that does not exist in your scene hierarchy. So I’d suggest checking to make sure that the object you are instantiating is in fact a prefab located in your project directory, not your hierarchy. This is my own understanding of how prefabs work at least. I’m still learning so I’m sure someone more knowledgeable will correct this.
If you post up some code or your scene I might be able to help you more.