I'm going through the "Creating your own resources" steps. Here's an abbreviated version of the demo resource bot_stats.tres
and the associated bot_stats.gd
script:
extends Resource
@export var health: int
func _init(p_health = 0):
health = p_health
And they suggest using it like this in another Node:
extends CharacterBody3D
@export var stats: Resource
func _ready():
# Uses an implicit, duck-typed interface for any 'health'-compatible resources.
if stats:
stats.health = 10
print(stats.health) # Prints "10"
Is it possibly to use a stronger type-hint? I'd love to have (and tried) something like:
@export var stats: BotStats
or
@export var stats: bot_stats
To get some intellisense rolling in the editor. But they give things like:
Error at (3,18): Could not find type "BotStats" in the current scope.
Is this possible?