Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | musa |
So i tried doing something with the images in a directory. I used the following code that mostly comes default as an example in godot -
func add_thumbnails(path):
var dir = Directory.new()
if dir.open(path) == OK:
dir.list_dir_begin()
var file_name = dir.get_next()
while file_name != "":
print(file_name , " is filename")
if !dir.current_is_dir() and file_name.ends_with(".png") and !file_name.begins_with("-"):
add_texture_rect(file_name)
print("Found file: " + file_name)
file_name = dir.get_next()
else:
print("An error occurred when trying to access the path.")
This is working fine in pc, but when i run it on android( using the small android icon at top right), the print statement only prints image.png.import files and not the images itself –
5.png.import is filename
6.png.import is filename
7.png.import is filename
9.png.import is filename
so it never runs the add_texture rect() function inside the if condition. here’s the code for the path argument(just a string) :
add_thumbnails("res://assets/paint/images")
any help ?
And the .png files are in the android file system to find?
spaceyjase | 2023-01-18 11:25
See my answer to a related question here:
Cannot traverse asset directory in Android? - Archive - Godot Forum
jgodfrey | 2023-01-18 15:58