[Issue/Bug]: DiscordRPC.refresh() only refreshes once, not everytime the scene is loaded #75
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happened?
Every time the world_generation.gd is loaded, the only time that works is the first time. After that DiscordRPC.refresh() never refreshes. Which means for me DiscordRPC.refresh() only works once per scene.
Version
1.3.1
Godot Version
4.3
Exact steps to reproduce this error
Downloaded with the Godot AssetLib
Just having a scene that creates a new word for the RichPresence everytime that is loaded.
GDScript
Godot output
No response
Additional information
No response
Checks
Can you provide more code/context? Where is it called when?
var consoantes = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']
var vogais = ['a', 'e', 'i', 'o', 'u']
var AsteroidField = ["Delta", "Gamma", "Omega", "Lambda", "Sigma", "Yotta"]
var asteroid_name
var asteroid_field
func _ready():
asteroid_name = create_asteroid_name()
asteroid_field = AsteroidField[randi() % AsteroidField.size()]
func create_asteroid_name():
# a bunch of code here to create a random word (it works)
After a lot of testing I fixed by adding the script to the Autoload and adding as a node:

Huh thats weird where did you attach it before? Are you sure you called refresh with the new values every time they change? Looks like you pnly called it once on ready
Well the problem is already fixed, and yes I am sure that refresh() was called every time values changed, but I think the problem was something to have to do with the _ready() function due to when the code it was in the _process() function it would work, changing constantly.
Maybe some weird thing with godot or your code but glad it worked