Hello, so I am trying to reset the button’s positions (and this event is fired when you go to the menu), but for some reason I’m getting an error. Here is my code:
app.on('buttons:fixoffset', function () {
this.item = app.root.findByName('Start Button');
this.item1 = app.root.findByName('Score Button');
this.item2 = app.root.findByName('Rate Button');
this.item3 = app.root.findByName('OK Button');
this.item4 = app.root.findByName('Share Button');
this.item5 = app.root.findByName('Pause Button');
this.item6 = app.root.findByName('Play Button');
var pos;
pos = this.item.getLocalPosition();
this.item.setLocalPosition(pos.x, -0.576, pos.z);
var pos2;
pos2 = this.item1.getLocalPosition();
this.item1.setLocalPosition(pos2.x, -0.576, pos2.z);
var pos3;
pos3 = this.item2.getLocalPosition();
this.item2.setLocalPosition(pos3.x, -0.38, pos3.z);
var pos4;
pos4 = this.item3.getLocalPosition();
this.item3.setLocalPosition(pos4.x, -0.576, pos4.z);
var pos5;
pos5 = this.item4.getLocalPosition();
this.item4.setLocalPosition(pos5.x, -0.576, pos5.z);
var pos6;
pos6 = this.item5.getLocalPosition();
this.item5.setLocalPosition(pos6.x, 0.78, pos6.z);
var pos7;
pos7 = this.item6.getLocalPosition();
this.item6.setLocalPosition(pos7.x, 0.78, pos7.z);
}, this);
Probably very inefficient. The first part works where it uses pos
, but the rest of them don’t and I can’t figure out why, thanks for any help!