in my code I have a controller script extending MonoBehavior. I need a reference to a BoxCollider2d which I assign normally with GetComponent.
When I name the reference:
I receive a compiler warning:
“Controller2d.collider hides inherited member ‘UnityEngine.Component.collider’.Use the new keyword if hiding was intended”
Ok so the Component class defines a member called “collider” I thought. but the script reference of the Component class does not mention the member variable. Also creating an empty script extending MonoBehavior does not bring up the variable “collider” in the code-completion.
Can anybody explain the warning? I could make it go away by choosing a different name like boxCollider, but I would like to understand where this warning is coming from.