'Foo' is a 'Bar', which is not valid in the given context
This error is caused by identifier misuse, and can appear in many differing contexts.
Some examples of identifier misuse:
new
from a constructor#// Incorrect:
Color color = Color(0, 0.5f, 0.9f, 1);
// Should be:
Color color = new Color(0, 0.5f, 0.9f, 1);
// Incorrect:
Renderer renderer = GetComponent(Renderer);
// Should be:
Renderer renderer = GetComponent<Renderer>();
public class Example
{
public void Foo () { }
// Foo can only be invoked like a method: Foo();
public void Bar () => Foo.Value;
}
You may have a method with the same name as a type. Either rename the method, or qualify that type through the use of its namespace.
public void Foo<T>() where T : IBar
{
// C# does not support this behaviour.
// Rethink your code structure to avoid this,
// or invoke the method directly via the specified static class.
T.Bar();
}