- Home /
Keyword `void' cannot be used in this context
using UnityEngine; using System.Collections;
public class NeedleRotateAround : MonoBehaviour {
public Transform gun;
public Transform pivot;
float prevAngle;
void Start ()
{
prevAngle = gun.transform.rotation.eulerAngles.z;
}
void Update ()
{
float currentAngle = gun.transform.rotation.eulerAngles.z;
float deltaAngle = currentAngle - prevAngle;
if(deltaAngle != 0)
transform.RotateAround(pivot.position, Vector3.forward, deltaAngle);
prevAngle = currentAngle;
}
}
after typed those, console show me two errors. 1. Keyword void' cannot be used in this context 2. Unexpected symbol
(', expecting )',
,', ;',
[', or `='
it said these happened on line 16. why is this happened?
Are you sure that the error appear in this file? The console gives you the exact file and linenumber...
Answer by Lovrenc · Jan 28, 2013 at 08:19 AM
I get no error what so ever. Try restarting the mono developer.
Your answer
![](https://koobas.hobune.stream/wayback/20220613091725im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
I can't save because of the this keyword 0 Answers
Monodevelop Bug/Syntax Highlighting 1 Answer
Can someone tell me whats the difference between these? 1 Answer
Dictation Recognizer does not recognize words 0 Answers
You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. 2 Answers