#5845·aframe

在退出 XR 会话后重新进入时,session.requestAnimationFrame 不是函数

作者: XRDeltas创建于 2026年6月30日更新于 2026年7月1日

AFRAME.registerSystem('render', { init: function() { this.rAFId = null; this.session = null; this._bindRender = this.render.bind(this); }, startXR: function(session) { this.session = session; this.session.requestAnimationFrame(this._bindRender); }, endXR: function() { this.session.cancelAnimationFrame(this.rAFId); this.session = null; // But old callback still references this.session }, render: function(timestamp, frame) { this.rAFId = this.session.requestAnimationFrame(this._bindRender); // Fails! // ... render code ... } }); }

内容来源: aframevr/aframe