Skip to content

Quality of life: issue warning when wrong value is passed to property_changed signal #100

Description

@hamsterready

Use Case

I want GECS to point my mistakes :)

Proposal

Hi,

in world.gd

## Notify observers when a component property changes
func _handle_observer_component_changed(
    entity: Entity, component: Resource, property: String, new_value: Variant, old_value: Variant
) -> void:
    for reactive_system in observers:
        # Get the component that this system is watching
        var watch_component = _observer_watch_cache.get(reactive_system)
        if (
            watch_component
            and component
            and component.get_script()
            and watch_component.resource_path == component.get_script().resource_path
        ):

I think it would be good to issue error/warning like you do in other places already (relationship I think) to tell the users that they are passing wrong value.

I did this:

component_instance.property_changed.emit(C_MyComponent, ...

instead of

component_instance.property_changed.emit(component_instance, ...

and took me a moment to debug 🙂

Did you consider forking instead?

  • I understand that not all feature requests will be implemented and that forking might be a better solution in some cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions