Godot Version
`3.5.3
Question
`need help with save and load data:
var setting_info =
func LoadData(file_path,data: String):
var json_data
var file_data = File.new()
if not file_data.file_exists(file_path):
json_data = FirstLoadData.firstload(data)
return json_data # Hoặc có thể trả về giá trị mặc định khác nếu bạn muốn
else:
file_data.open(file_path, File.READ)
json_data = JSON.parse(file_data.get_as_text())
file_data.close()
return json_data.result
func SaveData(file_path, data):
var json_data = JSON.print(data)
var file_data = File.new()
file_data.open(file_path, File.WRITE)
file_data.store_string(json_data)
file_data.close()
func _ready():
setting_info = LoadData(“res://Data/setting_info.json”,“setting_info”).
error show:
09-12 07:35:01.960 25746 25973 E godot : ERROR: Condition “p_mode_flags & FileAccess::WRITE” is true. Returned: ERR_UNAVAILABLE
09-12 07:35:01.960 25746 25973 E godot : at: _open (platform/android/file_access_android.cpp:54) - Condition “p_mode_flags & FileAccess::WRITE” is true. Returned: ERR_UNAVAILABLE
09-12 07:35:01.960 25746 25973 E godot : ERROR: File must be opened before use.
09-12 07:35:01.960 25746 25973 E godot : at: store_string (core/bind/core_bind.cpp:2182) - Condition “!f” is true.
and never save and cant load data on android mobile, debug USB. it run well in pc