Hi Everyone!
I'm calling a public method, Die, on an Area2D, from another class:
public void OnAreaEntered(Area2D area)
{
area.Die();
}
However, I'm getting this error message:
"CS1061: 'Area2D' does not contain a definition for 'Die' and no accessible extension method 'Die' accepting a first argument of type 'Area2D' could be found"
Area2D does not itself have this method, of course, but the class, Enemy, that inherits from it, does. But, I've tried this, and get the same error message:
public void OnAreaEntered(Enemy area)
{...
I've discovered that setting the parameter type to dynamic
makes the error message go away and the script compiles:
public void OnAreaEntered(dynamic area)
{...
But, this doesn't seem like a proper solution.
Does anyone happen to know what might be going on here or what the best solution is?
Thank you!
D13