So I’m trying to make a power up that gives two times the speed for 10 seconds, but my variables or WaitRealTimeSeconds are wrong.(I don’t know which one, but the log says the variable lines are causing the error) I try to call the variables but I get the error:
Assets/Scripts/PlayerController.cs(46,42): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
Here is the script, also, it says the error for both variables.
if (other.gameObject.CompareTag ("Speed")) {
other.gameObject.SetActive (false);
(float.speed * 2);
yield return WaitForSecondsRealtime (10);
(float.speed / 2);
}
I also tried (speed * 2) but it didn’t work so I looked at tutorials and they were in JavaScript and I need C#. Any help?