Forum rules - please read before posting.

Glitch with camera when scene is loaded from 'core' main menu.

Hello there,

I'm in the latter stages of getting my 'mini test' game out there and I'm running some debugs. I have an odd issue that when the character gets bitten by an angry dog, and a 'game over' screen appears, you 'load the save'. It loads the scene and the character but! the camera stops working correctly. the blue background of the level ( ambient camera bg colour ) appears and the cameras ratios and tracking goes out of sorts. Another interesting thing. If you play the level with the glitch, leave the scene and walk back in ( reloads ) it returns to normal.

Would anybody be able to offer any insight as to why that may be happening? It's quite an odd nuanced little quirk that I have run into.

Other potential helpful information:-

  • This bug test is run as beta of the published game, Unity isn't running in the background - all scenes are included.
  • The camera glitch only happens when the scene is loaded from the save - not from transitioning from the previous scene
  • The bug goes when to travel from scene 3 back to scene 2, then back to scene 3 again. It works normally.

Any pointers or suggestions are welcome.

Comments

  • edited October 2022

    What type of GameCamera are you dealing with, and what are they set to "target"?

    Check Unity's Console (or the Player log if testing a build) for any AC-related messages. The first thing to check will be that the camera has a "Constant ID" component, necessary to save its data in save-game files.

    When is the save being loaded originally recorded? Is this part of an auto-save system?

    If you can test in the Editor, it's possible to use AC's Save-file Manager (accessible from the Settings Manager) to read the raw data associated with save-files. That should reveal if the active camera is being correctly recorded - but if you can share details (screenshots of the GameCamera's Inspector + Actions involved) I'll try to see what's what.

  • Good morning Chris.

    So to sum up this only appears to happen once I test the standalone build - a 'development build'. I have closed unity and launched the game as a standalone app ( which is very exciting ). The camera works fine in all the scenes bar the last one. I had wondered if there was something that I had failed to set on publishing or something I need to change before publishing.

    To answer your questions

    • The camera 'should' be set to the player as with the other scenes
    • Constant ID - could it be that it hasn't saved or has the constant id been set in this scene?
    • "When is the save being loaded originally recorded? Is this part of an auto-save system?" Sorry you lost me a bit there. The Glitch appears if you load from that scene from a manually created save. It doesn't happen if you just load the scene - eg come through a door from the previous scene. Is that what you were asking?

    This only appears to be doing this outside of the Unity Editor if that is of any use?

    p.s do you have a way of uploading screen grabs from inside the forum?

    Thanks,

    J

  • Constant ID - could it be that it hasn't saved or has the constant id been set in this scene?

    A GameCamera requires a Constant ID component to be attached if you want its active-state to be restored when loading a save-game file. This isn't automatic - you'll either have to attach this manually, or use the Settings Manager's "Auto-add save components to GameObjects" button.

    The Manual's "Saving scene objects" chapter covers how and when to attach such components.

    do you have a way of uploading screen grabs from inside the forum?

    The forum can't host images, but you can upload them to imgur.com and post here them as links.

  • Thanks Chris, that appears to have done something when tested from inside the Unity Editor / Play. I ticked the"Auto-add save components to GameObjects". Is there a best practice for using this option eg - tick this once the game is nearly edited and ready 'to go'? Also, is there a way to flush out all of the save data when doing play tests? eg wipe all the saved data?

    Thanks Chris.

  • edited November 2022

    Is there a best practice for using this option eg - tick this once the game is nearly edited and ready 'to go'?

    Save components must be added in order for the save system to function correctly. This includes the updating of scene data as the Player revisits scenes, without necessarily saving the game.

    You can run it as often as you like - it won't remove anything - but more important is testing that it works correctly. As an automatic tool, it will try to guess where save components are necessary - so testing its results will be necessary.

    Also, is there a way to flush out all of the save data when doing play tests? eg wipe all the saved data?

    You can delete saves and profile data from within the Save-File Manager, accessed from the Manage save-game files button just beneath the auto-add button.

  • Excellent, Thank you Chris. This went a long way thank you, although I'm still trying to work out why a glitch is happening in a new area when publishing the game to Mac outside the editor. For some reason when this is loaded the last scene global variable doesn't fire - but does in the editor. Strange! :)

  • Create a new thread with details / steps to recreate the issue, and I can look into it.

  • Thanks Chris. I shall take a look first and then put my hand up at the back of the class. Thanks! J

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.