Extra output in debug.log

Hi Nina,
You can see my exit as I’ve activated it. However, my question is why the debug produces 2 outputs? It should be 1. You can see the console. It appears 2x. Check my code. I have tried by setting more logical operators but 2 outputs persist. As you can see, I’ve tried different code.

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("coin"))
            //if (other.gameObject.CompareTag("coin") && (total_coins < 2) && other.gameObject.CompareTag("exit") == false)
            {
            other.gameObject.SetActive(false);
            count = count + 30;
            total_coins = total_coins + 1;
            string_coins = total_coins.ToString();
            combination = count.ToString();

            score.text = ("Score: " + combination);
            Total.text = ("Coins:" + string_coins + "/2");

        }

        //if (other.gameObject.CompareTag("exit") == true && (total_coins == 2))
        if (other.gameObject.CompareTag("exit") == true && (total_coins == 2))
        {
            Debug.Log("Entered box");

        }

Can you show the collider? Maybe the ball is colliding with two different colliders?

This topic was automatically closed after 18 hours. New replies are no longer allowed.

Privacy & Terms