Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read properties of undefined (reading 'originalColor') #5212

Closed
mikemainguy opened this issue Jan 11, 2023 · 5 comments · Fixed by #5223
Closed

Comments

@mikemainguy
Copy link

Description:

  • A-Frame Version: 1.4.1
  • Platform / Device: Oculus Quest 2
  • Reproducible Code Snippet or URL: https://dev.immersiveidea.com/local
  • launch that site, go into immersive mode, and hit b button on controller

local:15 Uncaught TypeError: Cannot read properties of undefined (reading 'originalColor')
at NewComponent.updateButtonModel (aframe-master.js:18543:1)
at NewComponent.updateModel (aframe-master.js:18538:1)
at module.exports.onButtonEvent (aframe-master.js:34703:1)
at AEntity.onButtonTouchEnd (aframe-master.js:18275:1)
at AEntity.nrWrapper (local:15:29524)
at AEntity.emit (aframe-master.js:25830:1)
at NewComponent.handleTouch (aframe-master.js:22514:1)
at NewComponent.handleButton (aframe-master.js:22440:1)
at NewComponent.updateButtons (aframe-master.js:22426:1)
at NewComponent.tick (aframe-master.js:22385:1)

I don't observe functional change (button events still fire and my app works), I'm not sure if there's supposed to be other things happen (my buttons and thumbsticks are all black and hard to see...IDK if I've misconfigured something or something changed when we added the button color changes....which I really like BTW.

@mikemainguy
Copy link
Author

mikemainguy commented Jan 11, 2023

Actually on further investigation this appears to be the first tick after a button event handler is registered then goes away. Probably innocuous and/or because I have some debugging enabled.

@dmarcos
Copy link
Member

dmarcos commented Jan 12, 2023

I recommend creating a minimal test case to reproduce the issue with https://glitch.com/~aframe. It will be easier to investigate.

@vincentfretin
Copy link
Contributor

Also see https://github.com/aframevr/aframe/pull/5103/files#diff-2ee48b207a426377ea32a1749d345fd8c9b1adbe0b9d971eccb7860e1fb41cd2R461 that introduced the new code with originalColor. Changing this.buttonMeshes[buttonName].originalColor to (buttonMeshes && buttonMeshes[buttonName] && this.buttonMeshes[buttonName].originalColor) may be enough to fix the issue, we have the condition at line 464 just below so this change make sense. Can you try the change @mikemainguy and create a PR?

@vincentfretin
Copy link
Contributor

It should be fixed in #5223, if you can test @mikemainguy that would be awesome.

@Utopiah
Copy link
Contributor

Utopiah commented Jan 25, 2023

Same problem on the Pro

dmarcos pushed a commit that referenced this issue Mar 30, 2023
… model is loaded (#5223)

* Check if buttonObjects or buttonMeshes is defined before accessing it, this fixes Quest 2 buttons highlighting errors when the model is not loaded yet (fix #5212 and #5220)

* check this.buttonMeshes before calling this.onButtonChangedV3

* Revert "check this.buttonMeshes before calling this.onButtonChangedV3"

This reverts commit 7b2cda9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants