Here may be the problem.
I had this component that also gave me an error when switching spaces.
TypeError: null is not an object (evaluating 'component.data.intervalTrueId')
at remove cyclicblinkingUP.ts:63:43
at (anonymous) runtime.js
at forEach [native code]
at p runtime.js
at w runtime.js
at tick runtime.js
at r runtime.js
at (anonymous) runtime.js
at e runtime.js
so i commented out remove of listeners and that’s when above errors start to occur (but there was a time it was working)
here is the component:
import * as ecs from '@8thwall/ecs'
declare const THREE: any
ecs.registerComponent({
name: 'cyclicPositionAnimationDOWN',
schema: {
bl_interval: ecs.f32,
bl_delay: ecs.f32,
bl_duration: ecs.f32,
// No extra schema parameters needed.
},
schemaDefaults: {
bl_interval: 3000,
bl_delay: 800,
bl_duration: 200,
},
data: {
// Store interval IDs so we can clear them later.
intervalTrueId: ecs.ui32,
intervalFalseId: ecs.ui32,
},
add: (world, component) => {
const interval = component.schema.bl_interval
const delay = component.schema.bl_delay
const howlong = component.schema.bl_duration
// console.log(ecs.PositionAnimation.get(world, component.eid))
// Set an interval that, every 3000 ms, sets loop = true.
const intervalTrue = world.time.setInterval(() => {
ecs.PositionAnimation.set(world, component.eid, {
fromX: 0,
fromY: 0.241,
fromZ: 0.693,
toX: 0,
toY: 0.289,
toZ: 0.776,
autoFrom: false,
duration: howlong,
loop: true,
reverse: true,
easeIn: false,
easeOut: false,
easingFunction: 'Quadratic',
})
// console.log('blinking')
}, interval)
component.data.intervalTrueId = intervalTrue
// console.log(ecs.PositionAnimation.get(world, component.eid))
// Set another interval that, every 3300 ms, sets loop = false.
const timeout = world.time.setTimeout(() => {
const intervalFalse = world.time.setInterval(() => {
ecs.PositionAnimation.remove(world, component.eid)
// console.log('not blinking')
}, interval)
component.data.intervalFalseId = intervalFalse
}, delay)
},
tick: (world, component) => {
// No per-frame logic needed.
},
remove: (world, component) => {
// Clear both intervals when the component is removed.
world.time.clearTimeout(component.data.intervalTrueId)
world.time.clearTimeout(component.data.intervalFalseId)
console.log('[cyclicPositionAnimation] Intervals cleared')
},
})