Skip to content

Conversation

@willeastcott
Copy link
Contributor

@willeastcott willeastcott commented Jan 5, 2026

Fixes a runtime error when reloading scenes using the annotation script (e.g., the 3D Gaussian Splat annotations example in the Examples Browser).

The _unregisterAnnotation method was calling handle.unbind() on event handles, but PlayCanvas engine's EventHandle class uses off() to unsubscribe, not unbind() (which is the method used by @playcanvas/observer).

Error before fix:

Uncaught TypeError: handle.unbind is not a function
    at AnnotationManager._unregisterAnnotation (annotation.mjs:788:57)

Fixes #8331

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a runtime error that occurred when reloading scenes using the annotation script. The issue was caused by calling the wrong method (unbind() instead of off()) on PlayCanvas EventHandle objects during cleanup.

  • Corrects the method used to unsubscribe event handles from unbind() to off()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@willeastcott willeastcott merged commit 47acaa2 into main Jan 5, 2026
13 checks passed
@willeastcott willeastcott deleted the annotations-off branch January 5, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Annotations example issue reloading

3 participants