Hi guys, I’m implementing my nakama connection system in Godot 4. And currently I’m facing this problem:
When I try to call the “authenticate_email_async” function.
I get this “Invalid call. Nonexistent function ‘intance’ in base ‘Nil’.” It is possible that it is a silly mistake on my part, but I have been googling and I have not found a solution, I leave you the images so that you can see that everything is in order (in my opinion) and that it should be working. Thanks in advance.
var nakama_client: NakamaClient :
get:
return nakama_client # TODOConverter40 Copy here content of get_nakama_client
set(mod_value):
mod_value # TODOConverter40 Copy here content of _set_readonly_variable
# For other scripts to access:
var nakama_client: NakamaClient :
get:
return nakama_client
set(mod_value):
nakama_client = _set_NC(mod_value)
func _set_NC(value: NakamaClient) -> NakamaClient
return value
(SOLUTION) I have found a solution (Although I don’t know if it is the correct way, but it works) The problem is that the client was getting null all the time. And I had to load this get_nakama_client function like this and add it to the return.
I’m glad you got it working. I would point out though that this does not appear to be a Nakama issue and is instead an issue with the Godot code in your project.
For example, the getter you have implemented will always create a new Nakama client (e.g. NC will never not be null during the if statement because you have only just defined it at the top of the get_nakama_client function so the Nakama.create_client will always happen); this in turn means your setter nakama_client = mod_value isn’t really doing anything useful because the underlying value of nakama_client is never used.
For a good example of implementing Nakama in Godot I would advise looking at our Fish Game example project.