Godot Version
4.3.stable as of writing
Question
I got a maybe-erroneous “script not found” error here; I made a new resource of a custom script-defined type, clicked the “script” drop-down, made a new script that extended the custom type, clicked “make unique” so that it wasn’t displayed as a separate file, wrote it out, and ran the project. However, when a game object attempted to load the .tres file I’d made, execution halted and the editor told me “Error at [location of load() call]: could not find script [filepath to .res file]::GDScript_5nibc.
” This does not happen when the script is a separate file; it only happens when the script is “made unique”.
Goal
I want a class of .res files that can have unique scripts that I can directly edit through the editor. These are actions the player and enemies can take during turn-based combat. Right now, I have a BattleAction class that @extends Resource
and three scripts (so far), each of which @extends BattleAction
. Each of these scripts is only going to be used for one corresponding .tres, so I want it to be unique.
Since I am simply able to declare a new script file and assign it to the object without making it unique, it’s not the end of the world if there isn’t a fix for this. However, I do want to cut down on the amount of different files being displayed in the editor, so if someone’s got some insight about what to do about this, it would be much appreciated.
I don’t think built in scripts can create a class_name
. You might be able to extend BattleAction when your script is not “unique” aka built-in. You do not want the base script to be unique.
To clear things up: The base script was not made unique, but the three extend
ing scripts were.
Why are you making them unique? The root of issue is caused by making a script instance unique.
It sounds like you are looking to create a custom resource.
And to just extend the base resource script normally.
I don’t want to @extends Resource
directly if I can help it. Making it so that each individual object @extends BattleAction
will allow me to explicitly declare other variables as only being able to hold BattleAction-typed resources. Since BattleAction.gd
@extends Resource
anyways, I was hoping that the BattleAction
class would carry over the ability for instances to contain unique scripts, each of which @extends BattleAction
specifically, rather than just a resource more generally.
UPDATE: 1 day later, the issue simply stopped happening. I have no idea why: I suppose the engine was simply being buggy.
UPDATE AGAIN: This feature stopped working again. After relaunching the engine, I encountered the same issue with a unique resource that had previously worked perfectly fine. This issue persisted after I relaunched the Godot game engine. I might just file an issue on the Github.
Before you file an issue, can you post a MRE? That we can test locally.
Yeah, you’re probably right. In progress…
1 Like