Unused parameter error for "collision"?

I’m circling back through Block Breaker again from the beginning and I’m getting a new warning for OnTriggerEnter that I didn’t get last time through:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LoseCollider : MonoBehaviour
{
     private void OnTriggerEnter2D(Collider2D collision)
     {
          SceneManager.LoadScene("3-EndScene");
     }
}

sends an IDE0060 message saying “Remove unused parameter ‘collision’”, and the trigger (which is active) does not activate when the ball passes through it. I have double- and triple-checked that my string reference is accurate, and I have even removed and re-built the Build Settings. I’ve re-watched this video several times and can’t find a difference in process.

I re-checked my old code from the first time I did this after the remaster and it is identical to what I have now.

The one difference from the course is that I’m running in 2019 (2019.1.5f1), so I don’t know if there is a new way Unity is handling trigger events in code in the 2019 update or if I’m just going crazy. :joy:

FYI, I used a Debug.Log to see if it was even registering a collision, and it’s not. The ball has a RigidBody and a Circle Collider, the Lose Collider is a trigger, I can’t wrap my head around what’s broken here.

I updated to the June 10 stable release of 2019 (2019.1.6f1) and now it works as expected, so I think I was just experiencing a nasty little bug in the prior stable release.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms