make moving object stop

hi
my object is moving at certain speed and i have to make it stop when get touch by another object , as here is the line which make the object move transform.position.x +=0.03; and this line is in up0date function i just want to know if Time,timescale will work or i have to do from another way …

thankz in advance

Yes, adjusting the time scale will stop your object, but it will also stop every object; it will stop all Update loops from running.

If all you want to do is stop your actual object, then stop calling it’s update loop! Set the Component’s enabled flag to false, thusly;

enabled = false;

When the object is touched, just set a flag and put your line in an if statement to check the flag

if (!ObjectIsTouhced)
{
   transform.position.x +=0.03; 
}