Try to access file


I tried to access file in item_folder but its not working i have a file .tres in
ress://Plant/SeedBags but i dont know why its null

It says your item_folder is not a String, try to make item_folder to a String by using

var item_folder : String
or
str(item_folder)

If the above still doesn’t help, then it seems that when the node is trying to do DirAccess.open the item_folder was still unassigned, therefore you get that nil on there. Try to add 1 second wait.

its still not work so i skipped to do another thing. right now i tried to check if Player is on HoedLand

func _on_player_have_seed(): is work correctly but in line

if tile.get_custom_data("HoedLand") :
		grid_helper.visible = true
		print("Can Plant")

its not print “Can Plant” when i walk over my hoedland


and this is all my layer


and this is my main node

I saw a turtorial on yt, his code is work but my is not. i want to know why? T_T