Saving prefab gets reflected in version control

Discussion and help for Easy Save 3
Post Reply
PopQuizHotShot
Posts: 7
Joined: Tue Nov 24, 2020 12:48 am

Saving prefab gets reflected in version control

Post 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?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving prefab gets reflected in version control

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
PopQuizHotShot
Posts: 7
Joined: Tue Nov 24, 2020 12:48 am

Re: Saving prefab gets reflected in version control

Post 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?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving prefab gets reflected in version control

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
PopQuizHotShot
Posts: 7
Joined: Tue Nov 24, 2020 12:48 am

Re: Saving prefab gets reflected in version control

Post 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
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving prefab gets reflected in version control

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
PopQuizHotShot
Posts: 7
Joined: Tue Nov 24, 2020 12:48 am

Re: Saving prefab gets reflected in version control

Post 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!
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving prefab gets reflected in version control

Post by Joel »

Glad you managed to resolve your issue :)

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply