Camera Component Not Following Parent GameObject After Load

Discussion and help for Easy Save 3
Post Reply
dromo
Posts: 3
Joined: Fri May 19, 2023 12:09 pm

Camera Component Not Following Parent GameObject After Load

Post by dromo »

Hello,

I am currently facing an issue with the Easy Save 3 system in Unity. I have a camera component attached to a GameObject, and during runtime, the camera follows the movement of the GameObject as expected. However, when I save and then load the GameObject using Easy Save 3, the camera component no longer moves with the GameObject.

Here are the details of my setup:

The camera is a child of the GameObject and is correctly parented both before and after loading. I have confirmed this by checking camera.transform.parent.name.

The camera's settings appear to be saved and loaded correctly. The field of view, clipping planes, depth, rendering path, etc., are all the same before and after loading.

There are no Rigidbody components involved in the camera or its parent GameObject.

I am not using any events, callbacks, or coroutines to control the camera's behavior.

Despite these, the camera does not follow the GameObject's movement after loading. It seems to lose its dynamic relationship with the parent GameObject.

I would appreciate any insights or suggestions on how to resolve this issue. Is there a specific setting or process I need to follow when saving and loading GameObjects with child camera components?

In a forum post titled "Bug with camera when loading after auto-save" there seems to be a similar problem, and you mention the pixelRect variable. However, I do not make changes to this, and I have unchecked this variable so it is not saved. Despite this, my problem still persists.

Thank you in advance for your assistance.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Camera Component Not Following Parent GameObject After Load

Post by Joel »

Hi there, and thanks for getting in contact.

Camera following is usually controller by an external script rather than the camera itself, so it's not possible for me to replicate this from what you've said.

Please could you replicate this in a new project with a simple scene and private message it to me with step-by-step instructions so I can see what is happening at my end and debug it.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
dromo
Posts: 3
Joined: Fri May 19, 2023 12:09 pm

Re: Camera Component Not Following Parent GameObject After Load

Post by dromo »

Hi,

Thank you for offer of help. As it would be a complicated job to take apart my project to make a simple scene, I decided to completely take apart the save system for the camera and related classes and start it over again first.

I managed to fix it, but I have a question. The problem was I had an ES3 User defined save script for the Unity camera, as well as the standard ES3 save script for the camera that come with your asset. It was my user defined save camera script that was being called when my game object was being saved, and the problem was being caused by this script. As soon as I deleted it, the save system started using your standard save camera script.

I was not aware that I had created this extra user defined save camera script.

Should user defined save scripts never be created when there are ones that already come with your asset?

Thank you for your help.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Camera Component Not Following Parent GameObject After Load

Post by Joel »

Hi there,

It's not usually recommended to create your own ES3Type script when one comes with Easy Save as this usually indicates that the class can't be saved by simply saving it's fields.

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