I am coding a kind of a continous cyclic code for a movement of an object in my 2D game and my problem is that apparently I can’t use the name of my variable in operators (just in unity).
Here is my code:
var cicling = 0;
if (cicling < 1) {
Debug.Log("First Part of the cycle");
for (var i = 0; i < 11; i++) {
cicling = cicling + 0.1;
};
};
else if (1 <= cicling && cicling < 2) {
Debug.Log("Second part of the cycle");
for (var j = 0; j < 11; j++) {
cicling = cicling + 0.1;
};
};
else if (2 <= cicling && cicling < 3) {
Debug.Log("Third part of the cycle");
for (var k = 0; k < 11; k++) {
cicling = cicling + 0.1;
};
};
else {
Debug.Log("Fourth Part of the cycle");
for (var l = 0; l < 11; l++) {
if (cicling < 4) {
cicling = cicling + 0.1;
} else {
Debug.Log("Cycle complete, restarting it.");
cicling = 0;
}
}
}
Unity Basically says i cant use operators with “INT”.