Why could the game pause when the player is taking a pickup?
It cannot collect a pickup. It pauses the game on impact, and then goes right through after resuming.
Here is my player control program to make the player collect pickups:
using UnityEngine; using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag ("Pick Up"))
{
other.gameObject.SetActive (false);
}
}
}
Do you have your pickup's rigidbody component set as "Is Trigger"?
$$anonymous$$y first guess is that it isn't set as a trigger and your player is stopping when it first runs into the pickup and eventually pushes its way past the pickup and this looks like a "pause".
if your game pauses there should be an error printed into the console. Would be good to know that error and from which line in which script it is caused.
Yes, this should be the first stop on where to look.
If nothing shows up in the console but the game pauses the editor, you could see if there are any scripts that call Debug.Break. For example if there was a script on the item that was "picked up" (disabled) that during OnDisable called that...