x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Save game not working on android

I have searched around quite a bit and can't seem to figure this out. I am working on a very basic game and am trying to save high scores via blueprint. I am successfully saving and loading scores while playing in the editor but I can't seem to get the scores saved on android! The app has USB storage write permissions which is all it would need I assume?

I'm using the default app manifest and am packaging in development mode. Do I need to add anything to allow me to save the game?

If it helps at all, I'm using Save Game To Slot in blueprints on a SaveGame object.

Please help! I will include screenshots of blueprints if it helps!

Product Version: Not Selected
Tags:
more ▼

asked Dec 02 '14 at 02:02 PM in Packaging & Deployment

avatar image

tehhax
199 31 29 51

avatar image tehhax Dec 02 '14 at 11:16 PM

Shameless bump :(. I've been having this issue for days now and haven't found a solution. You are my only hope!

avatar image tehhax Dec 04 '14 at 01:27 AM

Has nobody else ever had this issue? I've pretty much exhausted all of the search queries I can think of to try and solve this. It's still unsolved and I would show everlasting gratitude to whoever points out the (hopefully obvious) mistake I've made. I would really appreciate someone with more experience in android deployment to at least tell me where to look. (Ie. Manifest, blueprint, etc). I have tried everything and it's really disheartening not receiving any responses :(.

avatar image Rudy Q ♦♦ STAFF Dec 04 '14 at 07:20 PM

Hello tehhax,

I have a few questions for you to help narrow down the issue that you are experiencing.

Quick questions:

  1. What version of the engine are you using?

  2. Could you provide screen shots of the blueprints involved in your issue?

  3. What android device are you trying to use?

  4. What is the exact version of the operating system on the device?

  5. Are you receiving any errors?

avatar image tehhax Dec 05 '14 at 02:16 AM

Thank you so much for the response!!! Let me answer your questions. Please let me know if you need anything else!

  1. UE 4.5.1

  2. I've attached the blueprint screenshots

  3. Samsung Galaxy S5

  4. Android version 4.4.2

  5. Not receiving any errors. If I was then it would really help!

Is there any settings (ie. default save directory) that I need to set to enable saving on android? I have only been using UE4 for about a month now and this is my first project that involves saving.

Once again thank you so much for your response. I was starting to lose hope! I apologize for all the bumps. If you're able to figure out the problem then I'm forever in your debt!

Blueprint Screenshots (Function in level blueprint): alt text alt text alt text

Here are the successful saved high scores being loaded in a test play in the editor.On android I just get all 0's alt text

savess1.jpg (217.4 kB)
savess2.jpg (230.3 kB)
savess3.jpg (276.7 kB)
savesuccess.jpg (75.9 kB)
avatar image tehhax Dec 05 '14 at 03:21 AM

I'm not sure if it helps but here is a screenshot from the mobile game. Notice my score is 5 but it's not saved. All scores default to 0. alt text

mobilescore.png (791.8 kB)
avatar image tehhax Dec 05 '14 at 06:18 AM

After adding new debugging output, I noticed that the second cast to MySaveGame is failing. I am only having this issue on android and the cast doesn't fail when tested within UE4.

Anyone have an idea why this may be happening?

Just to clarify: the cast directly after "Load Game From Slot" in the blueprints above is failing. It is only failing on android and does not fail when run within the editor.

avatar image Rudy Q ♦♦ STAFF Dec 05 '14 at 08:53 PM

Hello tehhax,

I have another quick question for you. Are you launching it straight to the device or are you packaging the game and then installing it onto the device?

avatar image tehhax Dec 05 '14 at 10:54 PM

Thanks again for the response! I am packaging it in development mode and running the batch file. I tried once packaging it in shipping mode with no luck.

I found the error log on the android device! This should definitely help! Here is the log:

    NewMap_C /Game/Maps/NewMap.NewMap:PersistentLevel.NewMap_C_0
    Function /Game/Maps/NewMap.NewMap_C:SaveGameSubmit:051E
[2014.12.05-14.02.22:168][  0]LogScript:Warning: Attempt to assign variable through None
    NewMap_C /Game/Maps/NewMap.NewMap:PersistentLevel.NewMap_C_0
    Function /Game/Maps/NewMap.NewMap_C:SaveGameSubmit:0534
[2014.12.05-14.02.22:169][  0]LogScript:Warning: Accessed None 'TopDownSaveGameObj'
    NewMap_C /Game/Maps/NewMap.NewMap:PersistentLevel.NewMap_C_0
    Function /Game/Maps/NewMap.NewMap_C:SaveGameSubmit:057F
[2014.12.05-14.02.22:169][  0]LogScript:Warning: Accessed None 'TopDownSaveGameObj'
    NewMap_C /Game/Maps/NewMap.NewMap:PersistentLevel.NewMap_C_0
    Function /Game/Maps/NewMap.NewMap_C:SaveGameSubmit:059F
[2014.12.05-14.02.22:169][  0]LogBlueprintUserMessages: SAVE GAME SUCCESS: false
[2014.12.05-14.02.22:169][  0]LogStreaming:Warning: Failed to read file '../../../TopDownMobileEating/Saved//SaveGames/Profile1.sav' erro

Android is clearly unable to find the .sav file! Do you know what's happening here? Why isn't the sve game file being created? Do I need to manually create it for Android?

avatar image tehhax Dec 05 '14 at 10:55 PM

Here is more of the log that is likely relevant but wasn't able to fit in the above comment because of the character limit. This part of the log is directly above what I just posted.

Function /Game/Maps/NewMap.NewMap_C:SaveGameSubmit:043C
[2014.12.05-14.02.22:168][  0]LogScript:Warning: Accessed None 'K2Node_DynamicCast_AsTopDownEatSaveGame_C'
    NewMap_C /Game/Maps/NewMap.NewMap:PersistentLevel.NewMap_C_0
    Function /Game/Maps/NewMap.NewMap_C:SaveGameSubmit:040D
[2014.12.05-14.02.22:168][  0]LogScript:Warning: Accessed None 'K2Node_DynamicCast_AsTopDownEatSaveGame_C'
    NewMap_C /Game/Maps/NewMap.NewMap:PersistentLevel.NewMap_C_0
    Function /Game/Maps/NewMap.NewMap_C:SaveGameSubmit:03DE
[2014.12.05-14.02.22:168][  0]LogScript:Warning: Accessed None 'K2Node_DynamicCast_AsTopDownEatSaveGame_C'
    NewMap_C /Game/Maps/NewMap.NewMap:PersistentLevel.NewMap_C_0
    Function /Game/Maps/NewMap.NewMap_C:SaveGameSubmit:03AF
[2014.12.05-14.02.22:168][  0]LogScript:Warning: Accessed None 'TopDownSaveGameObj'

avatar image Rudy Q ♦♦ STAFF Dec 08 '14 at 10:59 PM

Hello tehhax,

I made a test level and created a save system to try and reproduce this issue. I was unable to reproduce this on the device. My save file worked correctly. I have a few things that should be noted. When launching the project straight from the engine the save file will not work because there is no save file being created on the device. However, I see that you said that you were running it via the batch file which installs it onto the device. This worked for me. I have a couple of more questions for you that will help eliminate a couple of possible issues.

Quick questions:

  1. When you package the device are you using Android (ETC1)? This was what I was using.

  2. Are you making sure to set your variable "SaveSlotName"? I see that you "Get" this variable throughout your blueprint but I do not see it being "Set" anywhere.

avatar image Rudy Q ♦♦ STAFF Dec 18 '14 at 06:56 PM

Hello tehhax,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

avatar image tkrz Oct 26 '15 at 06:12 PM

A year after i have encountered the very same issue... Save is not loaded on android, even if in simulation mode it works. I have attached screen with both save and load.

UE 4.9.2, Sony Xperia M2, Android 5.1.0

alt text

save.png (171.5 kB)
avatar image Rudy Q ♦♦ STAFF Oct 26 '15 at 06:28 PM

Hello tehhax,

Would it be possible to provide a copy of the project or one that reproduces this issue so that we can take a closer look at the issue on our end?

avatar image tkrz Oct 26 '15 at 06:49 PM

Hi Rudy,

It's tkrz, not tehhax ;) Yes, i could provide you this project, can you give me some place to drop it?

avatar image Rudy Q ♦♦ STAFF Oct 26 '15 at 08:44 PM

Sorry about the mix up with the name. You can send it to me in a private message on the forums via drop box or google drive. You could also attach it to a reply here if you can get it to a small enough size. Please be sure to include the steps needed to reproduce this issue in the project provided.

avatar image Rudy Q ♦♦ STAFF Oct 27 '15 at 01:59 PM

After looking over your project and following the instructions that were given in the email, I found that the project was working as intended. However, I believe that I understand what issue it is that you are running into. From what I read in the instructions you appear to be using the launch on feature. This feature only loads up the current level and no other data. The files used to store the save data are not included when using launch on. I packaged out your project and then added it to the device that way and it saved the information as expected. I hope that this information helps.

Make it a great day

avatar image tkrz Oct 27 '15 at 02:21 PM

Well i have tried to package the app an then test it out on device, however with no luck. Tell me did it worked without any modifications to the blueprints? And on which Android did you tested?

Edit:

I have made some changes to my blueprints. For me it looks like Game instance is not getting Event Shutdown on time and it does not save anything. After i have added save to slot while clicking back in options it worked. Event Init is invoked correctly, however i did not see Event Shutdown to fire

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

With the additional information provided I was able to reproduce this issue on our end. I have written up a report ( UE-22652) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available. Thank you for your time and information.

Make it a great day

more ▼

answered Oct 27 '15 at 05:37 PM

avatar image

Rudy Q ♦♦ STAFF
47.4k 545 132 525

avatar image Rudy Q ♦♦ STAFF Oct 28 '15 at 05:33 PM

UE-22652 is unfortunately a limitation of the platform. There is no such concept as "quit" on Android. The Event shutdown won't get called by killing the app. One way to do this for Android is to save the game on pause instead. Another way to go is to put in a save game button, but pause is easiest. (paused fire off if you hit home or the pause button) I hope that this information helps.

Make it a great day

avatar image tkrz Oct 28 '15 at 06:04 PM

Hmm, that is strange... On Android, there are four lifecycle methods of activity: onStart, onResume, onPause and onDestroy (i'm not sure about last one name), and each and every one of them is called when activity is changing it's lifecylce.

The concept of quit is present as onDestroy method of activity. As for lacking this the only mobile platform which is missing this is propably iOS, which does not cover any events for shutting down, only pause as you said.

avatar image Chris Babcock STAFF Oct 28 '15 at 08:28 PM

onDestroy isn't reliable for this. From the Android onDestroy docs:

Note: do not count on this method being called as a place for saving data! For example, if an activity is editing data in a content provider, those edits should be committed in either onPause() or onSaveInstanceState(Bundle), not here. This method is usually implemented to free resources like threads that are associated with an activity, so that a destroyed activity does not leave such things around while the rest of its application is still running. There are situations where the system will simply kill the activity's hosting process without calling this method (or any others) in it, so it should not be used to do things that are intended to remain around after the process goes away.

avatar image tkrz Oct 28 '15 at 08:41 PM

Yes i know. I just wanted to point out, that Android has something like quit. Unlike iOS.

avatar image KillerSneak Apr 15 '18 at 05:45 PM

I'm having the same issue.

  • Local testing works fine (from PC)

  • Testing it by installing the APK with the BATCH file works fine

  • installing from the app store and save games don't work at all

Any news on this?

avatar image Rolthar May 18 '18 at 05:41 PM

I am having the exact same issue, is there a new permission for writing to device that we are missing? Or is this something that unreal broke? I am building on 4.19.2 and only when i install from the play store does the save game not work.

I really need a solution for this asap.

avatar image Knaril Jul 01 '18 at 01:43 PM

I have the exact same problem.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question