Thanks, I’ve tried it but I still get these errors…
func _save_to_csv(data: Array) -> void:
var file: FileAccess
if not FileAccess.file_exists("res://csv/" + "pds.csv"):
file = FileAccess.open("res://csv/" + "pds.csv", FileAccess.WRITE_READ)
file.store_csv_line(["seed", "samples", "time"])
else:
file = FileAccess.open("res://csv/" + "pds.csv", FileAccess.WRITE_READ)
var line := PackedStringArray()
for entry: Variant in data:
line.append(str(entry))
file.store_csv_line(line)
file.close()
(2) core/string/optimized_translation.cpp:136 - Condition "bucket_table_size == 0" is true.
Failed loading resource: res://csv/pds.csv. Make sure resources have been imported by opening the project in the editor at least once.
editor/editor_node.cpp:1213 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN
Failed loading resource: res://csv/pds.csv. Make sure resources have been imported by opening the project in the editor at least once.
editor/editor_node.cpp:1213 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN
Failed loading resource: res://csv/pds.csv. Make sure resources have been imported by opening the project in the editor at least once.
editor/editor_node.cpp:1213 - Condition "!res.is_valid()" is true. Returning: ERR_CANT_OPEN
extends Node
func _ready() -> void:
var data = []
for i in 20:
data.push_back([str(randi()), str(randi()), str(randi())])
var file:FileAccess
if FileAccess.file_exists('user://test.csv'):
file = FileAccess.open('user://test.csv', FileAccess.READ_WRITE)
else:
file = FileAccess.open('user://test.csv', FileAccess.WRITE)
file.store_csv_line(["ID", "Value 1", "Value 2"])
file.seek_end()
for i in data.size():
file.store_csv_line(data[i])
file.close()
Sorry I didn’t clarify. I was calling the _save_to_csv after each iteration within the _generate_poisson_disk_samples function.
But I suppose this a better way of doing it anyways.
func _ready() -> void:
if not Engine.is_editor_hint():
_csv_data.append(["seed", "samples", "time"])
for i in 10:
await _generate_poisson_disk_samples()
_save_to_csv()