Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | unholy182000 |
Hello i am using .cfg file and use ConfigFile helper class to read and save values for my game. It works well enough for windows and html5 exports. BUt when i tried to export to android my values says “null” where there should be integers. My file is in the user:// directory and i gave proper permissions as *.cfg in export options. I also gave permission in read and write user dictionary in android export permissions.
What am i doing wrong?
I uploaded a vey simple program to gave an example of my problem.
https://drive.google.com/file/d/1BZE64to5beHYd6rSgjPOuDft3vQSJGeP/view?usp=sharing
you can try to export this project to android you will see the value sees only “null”
unholy182000 | 2021-01-14 20:26
extends Control
func _ready():
read_config()
func read_config():
var config = ConfigFile.new()
var data = config.load("user://Config.cfg")
var value = config.get_value("section","value")
$Label.text = str(value)
func _on_Button_pressed():
var config = ConfigFile.new()
var data = config.load("user://Config.cfg")
var count = config.get_value("section","value")
count += 1
config.set_value("section", "value", count)
config.save("user://Config.cfg")
read_config()
unholy182000 | 2021-01-14 20:26
the code in the uploaded file.
Scene structure is very simple Control node has 2 childeren label and button when you press button label value increments by 1
unholy182000 | 2021-01-14 20:27
It works on godot play project, windows export and html5 export but not on android
unholy182000 | 2021-01-14 20:29
.cfg file is very simple also Config.cfg in user directory with
[section]
value = 1
unholy182000 | 2021-01-14 20:30