Data gets lost when saving resources

Godot Version

4.3.dev2

Question

I’m using custom resources to store the rules for a given tileset.

class_name WaveFunctionGenerator2DSettings extends Resource

var entries: Array[WaveFunction2DEntry] = []

After I populate the entries array, I save the resource like this:

var settings := WaveFunctionGenerator2DSettings.new()
settings.entries = data
	
ResourceSaver.save(settings, "res://grottos/pcg/wfc/rules/" + str(randi()) + ".tres")

When I check to see if the saved file is functional using the code below, all the entries that were there (see first screenshot) are lost (see second screenshot). What am I doing wrong here?

extends Node2D

@export var settings: WaveFunctionGenerator2DSettings


func _ready() -> void:
	breakpoint

Oh silly me, I need to add @export to view them in the inspector.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.