I would like that collider is paused for few seconds at the beginning of the game. I'm using this script on object. Thanks.
public class PickUpObject : MonoBehaviour {
void OnCollisionEnter (Collision Col)
{
if (Col.gameObject.name== "Player")
{
Debug.Log("collision detected");
Destroy(gameObject);
}
}
}
Use a timer to check it.
public class PickUpObject : MonoBehaviour {
public float timer = 10f; //seconds
private void Update()
{
timer -= Time.deltaTime;
}
void OnCollisionEnter (Collision Col)
{
if (Col.gameObject.name== "Player" && timer <= 0f)
{
Debug.Log("collision detected");
Destroy(gameObject);
}
}
}