Hello!
So, I'm working with AC for a client. I'm handling all the serialisation
stuff. We're using our own system for the saving/loading due to need
for console support etc. It's all pretty straight forward so far.
The
thing that I'm struggling to work out at the minute is that
LocalVariables.GetAllVars() is returning 0 results.
What I'm thinking is causing the issue is that we're not using AC's
scene loading, but handling it ourselves - so I'm thinking whatever
tells AC of the scene we're currently in isn't being set correctly.
On the flip side, Action scripts to set a local variable is working
correctly and the varibale is being set (and queried correctly from an Action script to determine dialogue choices), it's just not returning anything when
using LocalVariables.GetAllVars().
I've tried Kickstarter.sceneChange.AddSubScene and passing a new
SceneInfo with the scene name and index, but that doesn't seem to do
anything.
When querying the subscenes that are loaded (I don't know if this is the right place to look tbh), it's showing the currently loaded scene. If I look in the GameEditor when the scene is open, the local variables list is empty, but it shows local variables if I just manually open the scene in the editor. So my initial thought of whatever loads/refresh LocalVariables doesn't know what scene we're in looks increasingly less likely to be the problem...
Any pointers on what I might be missing would be much appreciated!
Thanks!
Comments
The LocalVariables.GetAllVars() method is a static one made for convenience. It's actually shorthand for:
KickStarter.localVariables.localVars;
I would, however, expect much more problems if you do not load scenes via AC - since AC does a lot of necessary tasks internally when changing scene. Through script, the correct way to change scene is with:
SceneInfo nextSceneInfo = new SceneInfo ("MyScene");
KickStarter.sceneChanger.ChangeScene (nextSceneInfo, true);
You haven't shared much detail so far as what exactly you're doing and why, but it is worth noting that custom scene-loading should not be necessary to get the save system working on consoles - just implementing a new format / location as per the docs should be enough.