The game does not show the device address from get_local_addresses (). It displays null instead. The problem arose during the test on the phone (everything is displayed on the PC)

What could be the problem?

Code:

`


var ip_default = IP.get_local_addresses()[0];
onready var dafault_ip_display = $default_ip_display;

func _ready():
	get_tree().connect("network_peer_connected",self,"_connected")
	
	for ip in IP.get_local_addresses():
		if ip.begins_with("192.168."):
			ip_default = ip;
			pass
		pass
	dafault_ip_display.text = str(ip_default)+" ipdef";
	print("default ip adress: "+str(ip_default));
	pass

`

First thing I'd try is either onready that var or do the assignment inside a function.

@Megalomaniak said: First thing I'd try is either onready that var or do the assignment inside a function.

did not help :(

Hmm, well I don't really deal with networking much and I don't do mobile development/deploy to phones so I can't really offer any help on this but perhaps someone else here has more experience with that.

Maybe the project needs permissions setup on the mobile export to read the IP? I'm not sure which would be needed though...

@TwistedTwigleg said: Maybe the project needs permissions setup on the mobile export to read the IP? I'm not sure which would be needed though...

And where to configure these permissions? What checkboxes should I check?

@AnCore said:

@TwistedTwigleg said: Maybe the project needs permissions setup on the mobile export to read the IP? I'm not sure which would be needed though...

And where to configure these permissions? What checkboxes should I check?

I don't know, I just know that sometimes you need to get permissions in the app to do certain things. I'd suggest look at the links in @dotted's post above and see if there is a similar option in the export settings in Godot and/or the Android/iOS build file (depending on what mobile platform you are building for).

2 years later