This is such a weird problem:
i am trying to add a force to a gameobject (ball).
When i call the shoot function in the update method of BallControl the force applies.
But when i call the function from another script the function is called (“logs “shoot””), but in this case the force is not applied. Can someone explain me what causes this? Unity 5.1
//These two function are in the script attached to the ball
voidFixedUpdate(){
when calling the shoot function like these the force is applied
/if (Input.GetKey(KeyCode.Space));
shoot ();
}/
}
public void shoot(){
Debug.Log(“shooting”);
Rigidbody2Drb = GetComponent ();
rb.AddForce (newVector2 (10.0f, 10));
}
//This is called in another script, when calling like this, the shoot method is executed but has no effect on the ball
ball.GetComponent ().shoot();