Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | njamal816 |
Hello,
I am trying to call SilentWolf Plugin using C# and I am getting this error while trying to load highscore.
E 0:00:01.336 get_tree: Condition "!data.tree" is true. Returned: nullptr
<C++ Source> scene/main/node.h:269 @ get_tree()
Scores.gd:119 @ get_high_scores()
I am trying to call using the format below.
GDScript MySilentWolfScores = (GDScript) GD.Load("res://silent_wolf/Scores/Scores.gd");
Object myGDScriptNode = (Godot.Object) MySilentWolfScores.New();
myGDScriptNode.Call("get_high_scores");
These are the lines in Scores.gd.
func get_high_scores(maximum=10, ldboard_name="main", period_offset=0):
HighScores = HTTPRequest.new()
wrHighScores = weakref(HighScores)
if OS.get_name() != "HTML5":
HighScores.set_use_threads(true)
get_tree().get_root().call_deferred("add_child",HighScores)
HighScores.connect("request_completed", self, "_on_GetHighScores_request_completed")
SWLogger.info("Calling SilentWolf backend to get scores...")
# resetting the latest_number value in case the first requests times out, we need to request the same amount of top scores in the retry
latest_max = maximum
var game_id = SilentWolf.config.game_id
var game_version = SilentWolf.config.game_version
var request_url = "https://api.silentwolf.com/get_top_scores/" + str(game_id) + "?version=" + str(game_version) + "&max=" + str(maximum) + "&ldboard_name=" + str(ldboard_name) + "&period_offset=" + str(period_offset)
send_get_request(HighScores, request_url)
return self
Any help is appreciated. Thank you.