Problem with code formatting


I have this code and the problem I have is that the update function is not inside the monobehaviour because unity detects the the closing (}) of the start function as the closing of the monobehaviour. Any help?

line 10, public cannot be used inside a function.

You also don’t want that to be a local variable in Start();

Therefore, move the declaration outside the function, and only do player = ... blah inside Start()

2 Likes