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!

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

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 :(.

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?

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):

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

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.

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.

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?

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?

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'

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.

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.

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

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?

Hi ,

It’s , not tehhax :wink:
Yes, i could provide you this project, can you give me some place to drop it?

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.

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

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

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

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