0
\$\begingroup\$

I get the following error every time I run the code: error: error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected

void OnCollisionEnter()
{
  Stick ();
}

Can someone offer a solution?

\$\endgroup\$
2
  • \$\begingroup\$ In addition to being a question about debugging your code (which is generally off-topic here, this is also a general programming question which is more suitable for SO. \$\endgroup\$ – user1430 Oct 27 '15 at 19:28
  • \$\begingroup\$ Apart from that, remember that we are not wizards and without context we are unable to pinpoint what is the exact cause of that error, There are a myriad of reasons why a piece of code might fail. \$\endgroup\$ – rlam12 Oct 27 '15 at 21:18
0
\$\begingroup\$

Well, it says that Stick is actually a type (a class for example), but you treating it as if it was a method. What is Stick and what did you intend to do with it?

UPD: As far as I understand, you're trying to make a MonoBehaviour to stick to whatever it touches using a method. It seems like there is already a class called Stick which interferes with your code. Calling this.Stick () might solve the issue.

\$\endgroup\$
2
  • \$\begingroup\$ It did not solve the issue. I get error CS1061. \$\endgroup\$ – That's me. Oct 27 '15 at 19:25
  • \$\begingroup\$ Again: what is 'Stick' and what are you trying to do with it? \$\endgroup\$ – Maks Maisak Oct 27 '15 at 19:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.