Question about Resource

Godot Version

4.6

Question

In Resource, I have this code:

extends Resource

# This variable is modified via Level Editor & shouldn't be changed via inspector
var grid_rows
# This variable is safe to be modified via inspector
@export cell_size

Now in documentation, @export is explained:

Mark the following property as exported (editable in the Inspector dock and saved to disk)

Does that mean my variable grid_rows will not be saved to disk when I exported the game?

Currently, I can modify/access the grid_rows variable successfully without the export annotation.

Is it okay not to use @export?

grid_rows won’t be saved to the disk. You may be able to override _get_property_list excluding the “private” variables, or ignore the property where you shouldn’t be editing it.

Thanks, I guess I should stop being stubborn and use the export annotation. I’ll just avoid changing it. I appreciate it! :clap:

I’d also like to add for those who have the same problem:
@export_category(“Do not change”) will help you remind that you shouldn’t change those properties.

@export_storage is the solution y’all. The variable still get saved in a disk but it won’t show up at the inspector.