Hi guys, I'm back with another question! So recently I've been trying to implement saving and loading into my game, based upon this tutorial. Now all is good - I've set up a save point, I can save and load from it - except for one problem: item collectors do not persist after loading a game.

I'd like it so that the player collects an item, and that item remains collected after loading. Here's a list of my save game settings, although I believe that everything is in order:

image

I have also inspected the XML file that is generated as the save file, and it appears that the data is being saved, so I'm not sure what I'm missing.

Could anyone confirm that this is working in their game? If so, could you suggest some settings I might have missed?
  • What are the settings on your item collector? My guess is the issue lies there.
    My little chunk of the internet: http://artemic.com
  • If your item collectors don't use Scene IDs to remember them, they wont be saved ...
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I'm using Scene IDs - here are the full settings for my item collector:

    image

    image

    Another thing I just noticed is that when the save point dialogue appears (i.e. before I actually try and load a game), the following error is displayed in the console:

    Error while parsing XML data: at System.String.IndexOf (Char value, Int32 startIndex, Int32 count) [0x00013] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/String.cs:1114
    at ORKFramework.XML.XMLParser.Parse () [0x00000] in <filename unknown>:0
    UnityEngine.Debug:LogError(Object)
    ORKFramework.XML.XMLParser:Parse()
    ORKFramework.XML.XMLParser:Parse()
    ORKFramework.XML.XMLParser:Parse()
    ORKFramework.XML.XMLParser:Parse()
    ORKFramework.XML.XMLParser:Parse()
    ORKFramework.SaveGameHandler:LoadFile(Int32)
    ORKFramework.SaveGameHandler:CreateFileInfo(Int32)
    ORKFramework.SaveGameHandler:CreateInfos()
    ORKFramework.Behaviours.SavePoint:StartEvent(GameObject)
    ORKFramework.Behaviours.BaseInteraction:StartMoveToInteraction(GameObject)
    ORKFramework.Behaviours.BaseInteraction:Interact()
    ORKFramework.Behaviours.InteractionController:Interact()
    ORKFramework.ControlHandler:CheckInteractions(GameObject)
    ORKFramework.ControlHandler:Tick()
    ORKFramework.ORKCore:FireTick()
    ORKFramework.ORKHandler:Update()


    Could it be that this is related? I can upload the save file too if that would help. Thanks so much for all your help so far.
  • That's most likely related to your issue. By any chance, are you using variable keys with spaces in it (e.g. 'variable key')?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I believe I have solved the problem. I didn't have spaces in my variable names, but I did in my scene names. Removing the spaces there fixed what was proving a very tricky problem.

    Just an idea, this may be a point worth clarifying in the documentation in a future update.

    Thanks for putting me on the right track!
  • Scene name spaces aren't a problem - the ORK demo scenes also have spaces in their names and it works fine (just tested it to make sure).

    Which ORK version are you using?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Hmm - that is strange. Like I say, I have got it working for now, although I'd like to know that everything is working as it should.

    I'm using 2.7.0, although I have made some changes to the ORK source code - perhaps it's possible that some of the changes I've made have had a knock-on effect elsewhere, although I can't think of any likely candidates.

    I can always package up a demo project, if you'd like to take a closer look at things. Although I realise you're probably very busy with grid battle systems and stuff :)
  • Unless you've changed something in one of the save game functions, I doubt your changes have anything to do with it. If you can test it with a pure ORK version and it's still happening, I'd like a test Unity project :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.