Every time I try declaring a variable in the default initialize function and try accessing it in another function later it says the variable is not defined.
For example:
// initialize code called once per entity
CheckRoll.prototype.initialize = function()
{
var results = [1,2,3,4,5,6];
var bestCount = 0;
var bestValue = null;
var secondCount = 0;
var secondValue = null;
var currentCount = 0;
var currentValue = null;
var diceValue = 0;
var dice = this.app.root.findByTag('Dice');
this.stopped = false;
this.timer = 0;
};
This code returns an error saying diceValue is not defined when I try to access it later.
Full Code: https://playcanvas.com/editor/code/529780?tabs=10861152