Skip to content

Commit

Permalink
Fix resource references not being loaded on exported builds (Godot 4.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
shomykohai authored Jul 9, 2024
1 parent add509f commit 8435b17
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion addons/pandora/model/entity.gd
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,14 @@ func get_resource(property_name: String) -> Resource:
if not has_entity_property(property_name):
push_warning("unknown resource property %s on entity %s" % [property_name, get_entity_id()])
return null
return get_entity_property(property_name).get_default_value() as Resource
# HACK: For some reason in Godot 4.3, resource properties are
# are considered Strings on exported builds with GDScript mode set to binary tokens.
# Here, instead of returning the default value and casting it to Resource,
# we check its type and we handle it accordingly.
var default_value = get_entity_property(property_name).get_default_value()
if default_value is not Resource:
return load(default_value)
return default_value


func get_array(property_name: String) -> Array:
Expand Down

0 comments on commit 8435b17

Please sign in to comment.