Question by
Ejpj123 · Apr 08, 2016 at 06:49 AM ·
unexpectedsymbolunexpected-symbolsymbols
Unexpected symbol `1' ??
Hi, I am trying to make a background that scrolls to the left on a 2d infinite runner game, and I am having this error saying : unexpected symbol "1". Here is my code: using UnityEngine; using System.Collections;
public class BackgroundScroller : MonoBehaviour {
public float speed = 0;
public static BackgroundScroller current;
float pos = 0;
void Start () {
current = this;
}
// Update is called once per frame
public void Go () {
pos += speed;
if (pos > 1.0f)
{
pos -- 1.0f; ERROR --> Unexpected symbol `1'
}
renderer.material.mainTextureOffset = new Vector2 (pos, 0);
}
}
Someone Please Help! I would be very grateful!
Comment
What should this do?
pos -- 1.0f;
Do you want to decrease the pos value by 1.0f?
pos -= 1.0f;
Best Answer
Answer by tomtominc · Apr 08, 2016 at 07:01 AM
You just have a syntax error.
// something like this would work
pos--;
// or this
pos -= 1;
Your answer
Follow this Question
Related Questions
Unexpected symbol 1 Answer
error CS1525: Unexpected symbol `offsetX' 1 Answer
error CS1525: Unexpected symbol `)', expecting `(' 1 Answer
Urgent Help Error cs1525! 1 Answer
Error CS1519 help 1 Answer