Your save game no longer works in your Android game? Probably you are using the Unreal Engine 4.27 and the Android Target SDK ’30’. Annoying, but not unsolvable, because that’s what we deal with in this article!
First of all, you should understand that your save system is not necessarily ‘not’ working, but that it mostly fails because of read or write permissions, or alternatively because your save system is not loaded correctly or in time.
Table of Contents
UE4.27 - Set Android Permissions
The Google Play Store requires all new Android apps to run on Target SDK 30 since mid-2021. This is possible with the Unreal Engine 4.27 and 4.26. However, a few small things have been changed in the file system, where your save system that you probably initialize in ‘Game Mode’ does not work.
Instead of initializing your save system in Game Mode, use the Game Instance, because it is always loaded first. This will prevent further errors. We will also check and request file permissions for Android in the Game Instance of the Unreal Engine 4.27. To do this, do the following:
- Open your Unreal Engine and create a new game instance. If you have already created one, you can simply use it for this purpose.
- To create a Game Instance, go to the Content Browser and right click, now click on ‘Blueprint Class’.
- Click on ‘All Classes’ at the bottom and search for ‘Game Instance’.
- Click on ‘Game Instance’ and confirm at the bottom of ‘Select’.
- Open your existing or created ‘Game Instance’ file.
- Now add the event ‘Init’. Right-click on it and search for ‘Event Init’ in the search field.
- Now pull out the Exec Output of ‘Event Init’ and search for:
‘Check Android Permission’ – Add this node.
- On the right side you can also see the process as a picture.
- In the node ‘Check Android Permission’ we now enter the External Storage Permission. We need this to check if the storage can be accessed.
- After the Branch Node, we will now add the ‘Request Android Permissions’ node at ‘false’, because otherwise we may not have the permission. This node has a string array input.
Create a new variable (type: String Array) and add the following permission:
- Next, pull out the ‘Return Value’ output from ‘Request Android Permissions’ and look for ‘Bind Event to Permissions Granted Dynamic Delegate’.
- Connect everything as shown in the picture on the right.
- Open your Unreal Engine Project Settings.
- Select the item (left) ‘Android’ to enter the Android Platform Settings.
- Change the ‘Target SDK Version’ here to 30, because this is currently required by the Google Play Store.
- Also check the box ‘Use ExternalFilesDir for UE4Game files?’
- If the SDK version 30 does not work for you (in the build), then you have to update your Android NDK and SDK version and update / edit ‘Android SDK’ under the UE Project Settings Menu.
- Now add the following below under the menu item ‘Advanced APK Packaging‘:
- Go to ‘Extra Permissions’:
- Now you can launch or export your game. From this point on, your save game should work without any further problems and should be able to store and retrieve data on your device. It can also happen that your cell phone or a security program sometimes prevents access to the external or internal SD card.
Comments & Feedback
Dear visitor, you are welcome to comment if it worked for you or not. Feedback is also always welcome to make the design and structure of articles more user-friendly. Please stay factual and friendly towards the author and other commentators. If you encounter a problem, please describe it as detailed as possible.
Click here to visit the German DerSky Discord Community (largest German Unreal Community).