Announcement

Collapse
No announcement yet.

Saving and loading problem on android only

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Saving and loading problem on android only

    Hello everyone,

    I'm using the attached save system in my game (1.png).
    I have this system in 3 blueprints in my game scene which are going to be saving/loading data somewhere during run time.
    They're always on the "Event begin play" and "Event Construct" nodes.

    When I need to save a value I use (2.png).
    When I need to load a value I use (3.png).

    and It works fine... In editor and development builds.

    Now in shipping builds it's a whole different story.

    First of all I have it it so the game is in one apk file and I have the "Use ExternalFilesDir for UE4Game Files" Option unchecked since
    I found it to be very prone to exploitation from the player, I also wanted the saves to be persistent through uninstalls.
    I added the following permissions to the "Extra Permissions" Section of the Advanced APK Packaging menu:
    android.permission.WRITE_EXTERNAL_STORAGE
    android.permission.READ_EXTERNAL_STORAGE
    android.permission.WRITE_INTERNAL_STORAGE
    android.permission.READ_INTERNAL_STORAGE

    I also added the to the android manifest manually just in case.

    If I build my APK as a development build, everything works fine, the APK asks for external storage permission on installation and the saving and loading work fine.
    When I try building my APK for distribution though the APK does not as for any permission and the saving and loading don't work, I then go inside the app permissions in my phone's settings menu and manually grant the game storage permission which makes the menu scene able to "sometimes" save and load a value or two, however the game scene is still unable to save/load anything.

    I've been pulling my hair out on this issue for a while, testing it on multiple devices and trying a bunch of different solutions that proved fruitless such as trying the "Use ExternalFilesDir for UE4Game Files" option.

    at the moment I'm at my wit's end and don't have a clue where to go from here, without this feature I really don't have a game, so any help you can provide my with is very very much appreciated.

    Thanks in advance.
    Attached Files

    #2
    Very strange it works on Development builds but not Shipping builds... which Android SDK versions do you have for min, target, and which NDK and SDK versions do you build against?
    Do you actually see the save game file on the device?

    This option "Use ExternalFilesDir for UE4Game Files" is required by the way if you're targeting SDK version greater than 23 (which will be required from Nov. on) and you want the saves to remain on app updates

    Headgear - VR/AR solutions

    VR Game Release: We Come In Peace... Oculus GearVR | Google Play Daydream

    Comment


      #3
      My min SDK version is set to 9 and the max is set to 26, my SDK API level & NDK API level are both set to "latest"..... I see the save file indeed if I choose the "Use ExternalFilesDir for UE4Game Files" and I can open it with a text editor and see the values inside but same problem the values get set in the menu level only, this is driving me up the wall to be honest.

      I don't really mind having "Use ExternalFilesDir for UE4Game Files" on anymore just as long as the save system works because my game completely relies on it to function properly and I don't really want to redo the whole game in a different engine .. I really hope there's a solution to this. Thank you either way for trying to help.

      Comment


        #4
        You say it works in the menu? Then it must be in the other levels where you call the save game is not done correctly in the blueprints as I've no issues using the save game accross different levels.

        Also I would move the save logic out of the pre-construct event into something a bit later like begin play in case that is causing the issue. Also did you try cloning the same BP logic from your menu BP in the other levels to see if that works.
        Headgear - VR/AR solutions

        VR Game Release: We Come In Peace... Oculus GearVR | Google Play Daydream

        Comment


          #5
          I've copied the above nodes to all the blueprints that have variables that I need saving, some of those are executed using in level triggers as apposed to the pre-construct event and even those still don't save, I'll try replacing all the pre-construct events with begin play events and see if that helps in anyway and post back the result.


          Update:
          Right now all my save instance and save data definitions are in the event begin play for game objects and event construct for widgets.
          Unfortunately the problem still persists, save system works well in editor, doesn't work in packaged android build.
          Last edited by MicroGT; 09-12-2018, 11:12 AM.

          Comment


            #6
            Did you find a fix for this? same issues on 4.20

            Comment


              #7
              Austinlele, Unfortunately I haven't been able to find any solution to this problem I even posted the issue on unreal answers here:

              https://answers.unrealengine.com/que...roid-only.html

              and haven't received any answers on it yet, I'm not sure where to go from here and am unable to publish my game in its current state.

              I thought about using a third party plugin as a workaround but there aren't any free ones and third party plugins usually come with their own share of problems and often their developers give up on updating them to the latest engine version and they become unusable.

              I may just migrate to another engine and redo the whole thing there.

              Comment

              Working...
              X