I have a problem with all my projects that whenever i attach a rigid body to an object and add an script for it to move,even something as simple as this
public float speed;
private Rigidbody agent;
void Start()
{
agent = GetComponent<Rigidbody>();
}
void FixedUpdate()
{
float H = Input.GetAxis("Horizontal");
float V = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(H, 0, V);
agent.AddForce(movement * speed);
}
the rigidbody starts moving without any input from my side and that in a direction b/w horizontal and vertical. Is there a cache or temp file i need to fix or what? I just need to know because this is happening to ever single project i start. Every single package i import,the object by default,without any input from me starts moving.