TheSniperFan / unityserializer-ng

Resurrection of the discontinued Unity Serializer by Mike Talbot from WhyDoIDoIt.com (Unity 5)
MIT License
61 stars 17 forks source link

Multiplying References in SaveGameManager #36

Closed Gerlone closed 7 years ago

Gerlone commented 8 years ago

Hello TheSniperFan,

First of thanks for updating till 5.4 and keeping it public. So what I noticed is in one of my scenes I had like 39 tracked objects and after loading the SaveGameManager referenced every Prefab like 3 times. So I was wondering if I save again if it would actually also save them 3 times. Maybe you also know a fix for this.

regards

Gerlon

TheSniperFan commented 8 years ago

Thanks for the bug report. Will look into this.

EDIT: Please send me something I can test this with. In my test scene prefabs don't multiply.

Gerlone commented 8 years ago

Hey,

sorry for my late response I was kinda busy and forgot about that. I've created a small scene. You can just drag&drop the prefab from the package into the scene click on save and load afterwards and you should see it. I included screenshots as well. I didn't include the Levelserializer. Hopefully it isn't just me getting this.

regards

Gerlon

SampleScene.zip

TheSniperFan commented 8 years ago

Thanks. Will take a look tomorrow.

TheSniperFan commented 8 years ago

Still can't reproduce. Make sure that you have the latest version of usng (not hosted here). Since all the object identifiers on the screenshot you provided are the same, it's possible that it's just a problem with the UI. As long as the actual objects don't get duplicated, no harm is done. To check that, attach a script to them that inherits from MonoBehaviour and implements the following function:

private void OnDeserialized() {
    Debug.Log(gameObject.name);
}

As long as the object only prints its name once after being loaded, everything is fine.

Gerlone commented 8 years ago

Alright thanks for testing. I tried that and I only get one print. It is still weird tho. I will try to reimport the package tomorrow and also check on if it was the latest or not.

regards

Gerlon

TheSniperFan commented 7 years ago

It's just the UI not being properly updated then. Don't worry. Glad I could help.