Does any one know how to change Update to something else for example:
I have this code which lets my object move… and i would like to change that code from (to make it stop)
THIS
transform.position += Vector3.up * Time.deltaTimespeed;
TO THIS
transform.position -= Vector3.up * Time.deltaTimespeed;
On Collision. This is my code:
float speed = 5.0f;
void Update() {
transform.position += Vector3.up * Time.deltaTime*speed;
}
void OnCollisionEnter2D(Collision2D collision) {
DestroyObject(collision.gameObject);
transform.position -= Vector3.up * Time.deltaTime*speed;
}
public void SetSpeed(float modifier)
{
speed = 5.0f + modifier;
}
}