🤔

CS0176#

Static member 'Foo' cannot be accessed with an instance reference; qualify it with a type name instead

You will see this error when accessing a static member (a method, property, or field) via an instance instead of the type name.

Documentation#

The documentation will specify whether a method is static, and your IDE will not provide autocomplete if you're using an instance to access that member.

Resolution#

🔴 Don't access the member via an instance#

GetComponent<AudioSource>().PlayClipAtPoint(position);

🟢 Instead, access it directly via the type name#

AudioSource.PlayClipAtPoint(position);

More examples#

// 🔴 Don't access the member via an instance:
var example = gameObject.Find("Example");
// 🟢 Instead, access it directly via the type name:
var example = GameObject.Find("Example");