I am trying to get a response from my webserver, where i am hosting my config.json – to setup further stuff in my godot project. Instead of starting the HTTPRequest, i get the error message for line 13 (http_request.request("")
) – Condition “!is_inside_tree() is true. Returning ERR_UNCONFIGURED”. Don’t know, if it helps, but this script is included by my main script, that only calls “getConfiguration”, but inside the “_process()” – Function. The error itself only comes up once.
extends Node
var globalJsonConfig = "Initial"
var loading = false
func getConfiguration():
var http_request = HTTPRequest.new()
http_request.request_completed.connect(_response_parse)
if loading == false:
loading = true
globalJsonConfig = "Loading.."
http_request.request("https://MY_URL.COM/config.json")
return globalJsonConfig
# Called when the HTTP request is completed.
func _response_parse(result, response_code, headers, body):
var jsonLib = JSON.new()
var json = jsonLib.parse(body.get_string_from_utf8())
globalJsonConfig = json.body
print("Loaded")