newlon/scripts/resources/game_identifiable_resource.gd
2025-08-02 23:32:32 +05:00

15 lines
434 B
GDScript

extends Resource
## Class that has unique GID specified by its filename.
class_name GameIdentifiableResource
## Game identifactor. Generates from resource filename. Should be unique.
var gid : StringName = ""
## Gets GID. If resource has none, generates one.
func get_gid() -> StringName:
if gid == "":
var split_path = resource_path.split("/")
gid = split_path[split_path.size()].trim_suffix(".tres").to_lower()
return gid