I've noticed that ORK's save system doesn't save game variables that are Vector3 values. As far as I can tell it only saves game variables that are strings or bools. Is this correct? If so, is there a way to save all the game variable values?
  • Sure it does - it saves all variable types, unless their variable key is excluded in Menus > Save Game Menu in the Save Settings.

    Can you post how you're setting the Vector3 variable value? Maybe there's a mistake in your setup :)
    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!
  • Hm, that's odd. I have a script that I use to move around an object. The script sets a Vector3 value to save its position in several spots. When I save the game and load it again, I print the Vector3 value and it's always (0,0,0).

    So to change the value I use:
    ORK.Game.Variables.Set("LastPosition", transform.position);

    It works as intended as long as the game is running, but when loading the game it resets to (0,0,0). I also change the value in the initial startup event, but I don't think that runs on load and the value it's changed to isn't (0,0,0), so I don't think that's the culprit.

    Could it have something to do with setting the value through a script? I'll check if I have something left-over from a while back that is messing with the value. You never know!
  • Well, if the script sets the value after the variable is loaded, it'd be the new value ...
    Where and when does the script run?
    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 went past all the instances where the variable is set by the script, but none of them should be taking place. It place the object at the vector3 position right at the start, but nothing changes the value right at the start. When I'm saving the game, the Vector3 isn't (0,0,0). I'm printing it to console to check for sure.

    I have the variable defined in ORK under Editor->Game Variables->Define variables. In ORK under Menus->Save Game Menu->Save Settings I have it set to save all Game Variables, with one variable excluded, which is of course a different one. ;)

    If I search the save file (which is unencrypted for now) I can find several of the Variable keys, but not this one. I imagine the variable keys for Vector3 values should also be in there, right? If that's correct I at least know for sure, the problem isn't due to loading the data, but due to saving the data.
  • In that case it's pretty safe to say that the variable isn't saved ...
    If you're certain that the variable is set by your code (i.e. the code is actually called sometime), the only other explanation would be that it's deleted before saving.

    Since this involves custom code, I'd need a Unity test project to check out what's happening. If you'd like, you can send it to contact@orkframework.com (e.g. uploading it on dropbox and sending me the link). Just a simple project with a scene set up where this occurs.
    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 tried creating a new variable, used an event to set it to a Vector3 value using a game event. I print it via script to check the change, but it also doesn't get saved, even if I set saving to selected variable and add it specifically.

    I'll try setting up a test scene soon.
  • Setting up variables in Editor > Game Variables doesn't do anything in your running game, it just adds the variable key to the variable selection list in the editor.

    Saving Vector3 variables is definitely working - just tested it to make sure :)
    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!
  • Actually, is there another way to save a game object's position for when the game is loaded, cus that might work just as well.
  • Beside storing it in global variables, you could also use Object variables on the game object itself and e.g. use an autostart event interaction to place the game object on the stored position when the scene loads.
    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!
  • Object variables aren't saving Vector3 values for me either. I managed to fix it for now, by using float values and just having an x,y,z value for the position. Right now I just have to get a move on, I'll try to setup a test project some other time. Maybe it'll just work then, who knows.

    But since it saves floats, it works.
  • Hm, yeah ... that's really strange. I'll need a test project where this happens, as this is definitely working and the functionality hasn't been touched in a long time :)
    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.