Page 1 of 1

Saving prefab gets reflected in version control

Posted: Fri Jun 18, 2021 11:49 pm
by PopQuizHotShot
Hi, when I save a prefab, the changes get reflected on the prefab object itself, which then gets detected in version control. Is this expected? How can I prevent this?

Re: Saving prefab gets reflected in version control

Posted: Sat Jun 19, 2021 9:20 am
by Joel
Hi there,

If you're saving and loading the prefab rather than an instance of the prefab, this is expected, as this references the prefab in Assets which is what your version control detects the changes of.

All the best,
Joel

Re: Saving prefab gets reflected in version control

Posted: Sun Jun 20, 2021 6:24 pm
by PopQuizHotShot
To my knowledge, I'm only saving the prefab instance (https://docs.moodkie.com/easy-save-3/es ... s-prefabs/)

I added the prefab script to the game object, and I'm calling LoadInto() and Save() in a component. How do I prevent saving the prefab itself?

Re: Saving prefab gets reflected in version control

Posted: Sun Jun 20, 2021 6:33 pm
by Joel
Hi there,

Please could you replicate this in a new, empty project and private message it to me with instructions? I've not had any reports of this happening, and I don't appear to be able to replicate it at my end.

All the best,
Joel

Re: Saving prefab gets reflected in version control

Posted: Sun Jun 20, 2021 6:40 pm
by PopQuizHotShot
Before I do that, can you tell me how would you go about saving the prefab itself (instead of the instance)? Maybe I'm doing something inadvertently

Re: Saving prefab gets reflected in version control

Posted: Sun Jun 20, 2021 6:48 pm
by Joel
Hi there,

Let's say that you had a variable on a script called myPrefab, and you dragged the prefab from Assets into this variable. If you then saved this variable, that would save that prefab, and not an instance of that prefab. Any situation where you pass the reference to the prefab in Assets to the ES3.Save method will save the prefab, not an instance of that prefab.

All the best,
Joel

Re: Saving prefab gets reflected in version control

Posted: Sun Jun 20, 2021 7:31 pm
by PopQuizHotShot
THANK YOU JOEL!

You helped me get to the bottom of the issue! I was in a character selection screen that didn't have the player prefab in it, so I was saving directly to the prefab asset in my CharacterSelect script. I just added an instance of a Player to the scene and used that as the reference instead!

Re: Saving prefab gets reflected in version control

Posted: Sun Jun 20, 2021 8:25 pm
by Joel
Glad you managed to resolve your issue :)

All the best,
Joel