Void error
I was working on my game when I got 2 errors:
(7, 14): error CS1519: Unexpected symbol
void' in class, struct, or interface member declaration. 2. (10,12): error CS1519: Unexpected symbol
void' in class, struct, or interface member declaration
Answer by Jessespike · Aug 24, 2016 at 08:30 AM
Missing semicolons and the "f" for the float values;
public float movementSpeed = 5.0
should be public float movementSpeed = 5.0f;
Note the f and semicolon at the end. f;
There's also another error that you'll discover after fixing the floats:
CharacterController cc = GetComponent(CharacterController);
This won't work in c#. It should be either:
CharacterController cc = GetComponent(typeof(CharacterController)) as CharacterController;
CharacterController cc = GetComponent<CharacterController>();
Instead of uploading screenshots, you can paste the code and format it with the 101/010.
Got another error:
error CS1061: Type UnityEngine.Transform' does not contain a definition for
Rotation' and no extension method Rotation' of type
UnityEngine.Transform' could be found (are you missing a using directive or an assembly reference?)
lower case "rotation" not upper case "Rotation", please consult the manual, the way things are cased is important and literal/explicit.
Your answer
![](https://koobas.hobune.stream/wayback/20220612091445im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unexpected symbol `void' 1 Answer
I need someone to help me: error CS1525: Unexpected symbol `void' 0 Answers
key word void cannot be used in this context 1 Answer
unexpected void error 1 Answer