With the bug of exiting the map, the scorer only adds when you collide from the outside-in. When you hit the wall from the inside of the map, it doesn’t function properly.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class scorer : MonoBehaviour
{
double hits = 0;
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag != "Hit")
{
hits++;
Debug.Log("You have bumped into a wall " + hits + " many times.");
}
}
}