I’m encountering an ESLint error while registering a custom component in Niantic Studio. The error occurs specifically on line 9 of my schema
definition for the component property speedBoostMultiplier
. The error message is: expected StringLiteral, MemberExpression or Identifierstudio-component
ecs.registerComponent({
name: ‘powerup-system’,
schema: {
speedBoostMultiplier: { type: ‘number’, default: 2 },
speedBoostDuration: { type: ‘number’, default: 5 },
invisibilityDuration: { type: ‘number’, default: 5 },
jumpBoostMultiplier: { type: ‘number’, default: 1.5 },
jumpBoostDuration: { type: ‘number’, default: 5 },
sizeChangeScale: { type: ‘number’, default: 1.5 },
sizeChangeDuration: { type: ‘number’, default: 5 }
},
rest of the components is fine but only the first line is having issue idk
schema’s are defined as just the type, the default value must be defined in schemaDefaults.
// This is a Component file. You can use this file to define a custom Component for your project.
// This Component will appear as a custom Component in the editor.
import * as ecs from '@8thwall/ecs' // This is how you access the ecs library.
ecs.registerComponent({
name: 'custom-component',
schema: {
speedBoostMultiplier: ecs.f32,
speedBoostDuration: ecs.f32,
invisibilityDuration: ecs.f32,
jumpBoostMultiplier: ecs.f32,
jumpBoostDuration: ecs.f32,
sizeChangeScale: ecs.f32,
sizeChangeDuration: ecs.f32
},
schemaDefaults: {
speedBoostMultiplier: 2,
speedBoostDuration: 5,
invisibilityDuration: 5,
jumpBoostMultiplier: 1.5,
jumpBoostDuration: 5,
sizeChangeScale: 1.5,
sizeChangeDuration: 5
},
data: {
// Add data that cannot be configured outside of the Component.
},
add: (world, component) => {
// Runs when the Component is added to the world.
},
tick: (world, component) => {
// Runs every frame.
},
remove: (world, component) => {
// Runs when the Component is removed from the world.
},
})