Skip to content

Commit

Permalink
Fix script loading with Godot 4.3
Browse files Browse the repository at this point in the history
Fixes various issue that came from Godot 4.3 changes in GDScript and loading:
#196 #187
  • Loading branch information
shomykohai committed Jul 19, 2024
1 parent 5dba6d4 commit 755eb94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions addons/pandora/model/type.gd
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ 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 Engine.is_editor_hint() and ScriptType.has_source_code():
return ScriptType.new()
else:
if 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 755eb94

Please sign in to comment.