transform.localScale resets automatically

Hello,

I have a gameObject (non-static) and i want to scale it down or up in a method.

mainObject = GameObject.FindGameObjectWithTag ("robotKyle");
mainObject.transform.localScale = new Vector3 (2, 2, 2);

at this point, i have a new ratio, not just 2, but this helped me to find the problem. As often as i call this method, the object gets scaled without any problems (in this case to 2), but if i stop firing this method, it flips back to the default scale-value.

further information: i am working with ARToolkit and by detecting a marker i call this method to make it bigger or smaller so this method is called repeatedly if the marker is detected. so the problem is, as soon as the marker disapears (and the method is not called anymore) the scale-value resets back.

EDIT AND SOLUTION: the mistake was, double given the tag “robotKyle” so two objects were named the same.

This sounds a lot like you have other scripts which set the localScale of your object. Perhaps some character controller with a ducking functionality?
You should create a minimal example with just your ARToolkit and nothing else. Perhaps just an empty GameObject you change. Then this behaviour shouldn’t happen anymore.