Forum rules - please read before posting.

Error on re-entering a scene.

edited October 2016 in Technical Q&A
Hey there. I keep getting this error when re-entering a scene I've visited before. What could be the cause?
(It's happening when I've set the platform to iOS)

InvalidOperationException: <VisibilityData xmlns=''> was not expected
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot (System.Xml.Serialization.XmlTypeMapping rootMap)
System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot ()
System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader)
Rethrow as InvalidOperationException: There is an error in XML document.
System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader)
System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.XmlReader xmlReader)
System.Xml.Serialization.XmlSerializer.Deserialize (System.IO.Stream stream)
AC.Serializer.DeserializeObjectXML[HotspotData] (System.String pXmlizedString) (at Assets/AdventureCreator/Scripts/Save system/Serializer.cs:354)
AC.Serializer.DeserializeObject[HotspotData] (System.String dataString) (at Assets/AdventureCreator/Scripts/Save system/Serializer.cs:234)
AC.Serializer.LoadScriptData[HotspotData] (System.String dataString) (at Assets/AdventureCreator/Scripts/Save system/Serializer.cs:665)
AC.RememberHotspot.LoadData (System.String stringData) (at Assets/AdventureCreator/Scripts/Save system/RememberHotspot.cs:83)
AC.ConstantID.LoadData (System.String stringData, Boolean restoringSaveFile) (at Assets/AdventureCreator/Scripts/Save system/ConstantID.cs:75)
AC.LevelStorage.SendDataToScene (AC.SingleLevelData levelData, Boolean restoringSaveFile, AC.SubScene subScene) (at Assets/AdventureCreator/Scripts/Save system/LevelStorage.cs:136)
AC.LevelStorage.ReturnCurrentLevelData (Boolean restoringSaveFile) (at Assets/AdventureCreator/Scripts/Save system/LevelStorage.cs:77)
AC.SceneSettings.OnStart () (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:104)
AC.MultiSceneChecker.Start () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:72)

Comments

  • edited October 2016
    This is down to the serialization of a RememberHotspot script in the scene.  If could be something to do with that particular Hotspot, but I suspect this is happening in all scenes?

    It could be an issue between the XML encoding and the iOS version on your device.  Before you enter the previously-visited scene, save the game.  This will generate a save file in your PersistentDataPath - the AC Debug log will print out the file location.  If you can find it and post the contents here, it should give us a clue as to what's wrong.

    Alternatively, you can try checking Save in Json format? (Experimental) in the "Save game settings" section of the Settings Manager.
  • What exactly could be wrong with a hotspot?

    It's only happening in this 1 scene so far.

    Saving in Json format didn't change anything.

    It's happening on 2 different devices with different iOS versions btw.


    (Sorry, I couldn't post the contents of the save file in this post because the forum didn't allow that many characters)
  • What's the ID number of the Hotspot, and what's the build index number of the scene it's in?

    Not sure what could be wrong - any special characters in the name?
  • I am not sure what Hotspot to look for.

    It's scene #2.

    There's no special characters in the any of the Hotspot's GameObjects titles.

    Are hotspot script component's allowed to be attached to set geometry etc? I've got some hotspots that are on a table for example, and when I move the table somewhere else I need them to move allong so they are children of that table.
  • Yes, Hotspots should be fine on geometry - though since they use their own trigger collider it's recommended to keep them as child objects rather than on the MeshRenderer directly.

    As this is only happening in one scene, we'll assume at this point that this is down to a single problematic RememberHotspot component, rather than all Remember scripts in your game.  We'll need to determine, then, which one (or ones) are causing the problem - so the next step wil be to disable all such components in your scene, test that it runs in iOS, and then re-enable them in turn until it no longer runs.  I appreciate that's a little tedious, but once we know which one is causing trouble, we can look into it properly.  It may be that you need to PM me the scene at that point, but let's isolate the issue first and see what we've got.
  • Okaaay, after lots of Hotspot enabling and disabling I found out that I animated a 2D Box Collider (disabled it with a keyframe). Should have guessed that's not allowed :) Fixed now. Thanks.
  • Only if it's on the same GameObject as your Hotspot - if you want to disable a Hotspot, you can use the Hotspot: Enable or disable Action.
  • Yes thanks. The manual is quite clear on that. I broke the rules on purpose because I wanted this Hotspot to block a few other hotspots. But when fading out the hotspot and disabling it with an action, the Hotspots 'behind' it weren't clickable. I think because the big disabled Hotspot was in the way.

    Disabling the collider during animation worked (except for this error of course). I deleted that keyframe and just moved the collider outside of the screen which works too.
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.