i was following a tutorial i follow it like a book and i got an error which i have no idea what could have cause it
it says:
Failed to get default value of “speed” in class “NewClass”. If using TypeScript, you also need to pass in the “default” attribute required by the “property” decorator.
the code i used:
const {ccclass, property} = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property
speed: number = 10 ;
onLoad () {
}
start () {
}
update (dt) {
this.node.setPosition(this.node.position.x+this.speed*dt,this.node.position.y);
if(this.node.position.x>this.node.parent.width)
{
this.node.setPosition(0,this.node.position.y);
}
}
}
not only that but i am also unable to set the value in cocos creator as it should
it should appear a box where i set the value for each individual zombies but the box is not even there.
please explain me why i got this error, what could have caused it and how to fix it.
Thanks!!