Forum rules - please read before posting.

Inital Value in Variables seems to not be set when playing a build

As the title suggests, some values which are set as false in the Inital Value drop down on the Variables tab of the AC Game Editor behave as if they are set to true when running a build of the game. Is there a step I must do when running a build to make sure all the values get set properly?

Comments

  • No, they should all be set as you define them.

    • Global or Local, and are they linked to Options Data?
    • How/when are you using them that makes you believe they are being set incorrectly?
    • What are your AC/Unity versions, and what platform are you building to?
  • Thank you for your response.

    I have now linked the variable to Options Data, previously it was linked to None. This has fixed the issue.

    Could you explain this a bit please? Should I link all variables to Options Data?

  • Linking to Options Data means that the Variable's value is tied to your PlayerPrefs (alongside audio volumes, subtitle display etc), and is independent of any save game data you have. You can read more about this in the Manual's "Options data" chapter.

    If it's just a standard variable that's used for logic processing, it ought to be left as None. If there is an issue with it set as that, I will need you to answer my other questions before I can help.

  • Thanks Chris.

    • So that particular variable was Global.
    • It was a variable that was changed after a hotspot was clicked for the first time. However when playing the build for the first time it responded with the action assigned for after that variable had been changed. I did have Saves which were made in editor playthrough after the variable had been changed, so maybe they interfered with the build?
    • I'm using Unity version 2018.3.6f1 and AC version 1.66.7
  • I did have Saves which were made in editor playthrough after the variable had been changed, so maybe they interfered with the build?

    Unless you were loading that save in your build, they shouldn't. You can try manually deleting the save game files (their locations are displayed in the Console), and resetting your Options data at the bottom of the Settings Manager to be sure, however.

  • As mentioned the issue is now fixed since linking the variable to Options data :)

  • edited April 2019

    Unless you wish for it not to be stored in save-game files: don't. It will lead to new problems, otherwise.

    Again, what platform you are building to?

  • Right, so save game files are a good default store place unless I get issues, in which case, Options Data.

    I do have another question related to Save Games:

    In your 2d Game Tutorial you click Auto-add save components to GameObjects.

    Is it safe to click this at any point in the project's development? Can I click it later to append more objects? Or can this only be clicked once at the completion of a project?

  • It's advised to back up your project beforehand (as the dialog box that appears will tell you), but it's intended to be clickable at any point - and repeated clicks should be fine, too.

    It is, however, a convenience tool - you should still understand what the operation entails. This is covered by the Manual's "Saving scene objects" chapter.

  • Thanks very much. Will do some reading up.

  • Ok so the Auto-add save components worked fine. Glad to know more about that and how to use it.

    For the original issue I did set that variable link back to None since you warned against setting it to Options Data.

    After some testing of builds what I'm finding is that variable is behaving like its switched to True before it is meant to be, only if I happen to have a Save game made (when running in Editor) after it is legitimately switched to True. If this Save game is removed everything runs correctly from the start. Save games made when running in a build do not cause this issue.

    I guess this isn't really a problem since a clean build will run correctly for a user. I wonder what is causing the in-Editor issue though.

  • You still haven't told me of your build platform, or the effects of resetting the Options Data.

    AC will log when it loads a save game file. In the Editor, this occurs in the Console. In builds, it'll appear in your Player Log. Is there mention of loading the file inappropriately there?

  • Sorry, must have missed the request. The platform is Windows 10. I'll get back to you about reseting Options data and the log.

  • After resetting the options data and deleting all save games first. Tests all came back working perfectly:

    In Editor:

    With no saves = PASS
    With save made in editor after point = PASS

    In Build:

    With no saves = PASS
    With save made in editor after point = PASS
    With save made in build after point = PASS

    Thanks as always, for your help Chris.

  • For the information of anyone interested, I was barking up the wrong tree.

    This variable was being triggered as TRUE at another place in the game, unbeknownst to me. Sorry basically was a bug due to an error made by me.

    It's fixed now and working well.

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.