Use of Resources in Godot

So this lecture brought to the forefront an issue/question I’ve had with how we are using Resources in Godot. All of my background is in Unity, so I cannot help but come to Resources and compare them to Scriptable Objects.

I was very surprised when we set up the Resources to hold the enemy’s current health, for exactly the reason this lecture revealed - because the Resource is a shared item, all enemies share the same health by default. I would have assumed it better to have a health stat somewhere in the enemy script or another script that read in the data from the Resource to set the starting/max health, which is how I would solve for that in Unity with Scriptable Object. The solution to make each enemy’s Resource a unique one feels like it defeats the purpose of using a Resource in the first place. Now every time we add an enemy to the scene, we have to remember to make their Health Resource unique. Is this just the expected way to handle things in Godot? Is there a potential flaw to doing things the “Unity way” in this instance?

Trying to be mindful of my Unity bias when learning this new tool, but in this instance I just can’t see the logic behind the course’s solution. Thanks!

The specific lecture I am trying to reference is 10_GI_GRA. The lecture ID wouldn’t save with my comment for some reason.

@FossRyan tagging you as I don’t know if anyone saw this when I posted originally. Thanks!

Normally I’d say keep it in the main script as that’s the Godot way but I’ve personally started housing starting having stats in a node class childed. So long as there’s a reference somewhere it’s fine

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

Privacy & Terms