Godot Version
4.2.2
Question
Hi all, as per title I would like to have a certainty about custom resources and I was wondering that if I create one I can enter any data I want of a given object represented by a scene or node, while for game logic, and that is to exploit this data and thus give functionality to the game(or logic?) I should use the script attached to a given scene “x” that I create?
Yes, if nodes have the same resource they share their values, which saves on memory. Game logic should almost always be handled by the attached script, but the resource can also hold methods e.g.:
class_name Rectangle extends Resource
@export var width: int = 2
@export var height: int = 4
func get_area() -> int:
return width * height
1 Like
Thank you for responding, I just wanted to make sure of the idea that I have.
1 Like