Skip to content

Commit

Permalink
Fix script loading on Godot 4.3 (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
shomykohai authored Jul 20, 2024
1 parent 5dba6d4 commit de31aa6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions addons/pandora/model/type.gd
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ static func lookup(name: String) -> PandoraPropertyType:

if ResourceLoader.exists(type_path):
var ScriptType = load(type_path)
if ScriptType != null and ScriptType.has_source_code():
return ScriptType.new()
if ScriptType != null:
if ScriptType.has_source_code() or ScriptType.can_instantiate():
return ScriptType.new()

return UndefinedType.new()

Expand Down
2 changes: 1 addition & 1 deletion addons/pandora/util/script_util.gd
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static func create_entity_from_script(

static func _get_entity_class(path: String) -> GDScript:
var EntityClass = load(path)
if EntityClass == null:
if EntityClass == null or not EntityClass.can_instantiate():
push_warning("Unable to find " + path + " - defaulting to PandoraEntity instead.")
EntityClass = PandoraEntityScript
return EntityClass
Expand Down

0 comments on commit de31aa6

Please sign in to comment.