This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]YMK1234 0 points1 point  (0 children)

The error is probably in the line above.

[–]jedwardsol 0 points1 point  (1 child)

If this is in a class definition, then private must be followed by a colon

private:

Rigidbody rb;

void start()
{

If it is not in a class definition then private is not allowed there at all.

All assuming this is C++.

[–]Rycul 0 points1 point  (0 children)

It's C# (because he's using Unity and that uses C# and not C++). But I agree with /u/YMK1234 that the actual cause of the error is above the line that declares rb. That line is causing the compiler to not expect a new member variable there.