error CS1002 ; Expected

I am starting with unity c# and I got this error
Assets/Scope.cs(39,15): error CS1002: ; expected
I can’t find it
this is my code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Scope : MonoBehaviour {

public Animator animator;
public GameObject scopeOverlay;
private bool isScoped = false;

void Update ()
{
if (Input.GetButtonDown(“Fire2”)) {

isScoped = !isScoped;
animator.SetBool(“Scoped”, isScoped);
scopeOverlay.SetActive(isScoped);

if (isScoped)
StartCoroutine(OnScoped());
else
OnUnscoped();

}

}

void OnUnscoped () {

scopeOverlay.SetActive(false);
}

IEnumerator OnScoped () {

yeild return new WaitForSeconds(.15f);

scopeOverlay.SetActive(true);
}

}

Me neither, you don’t post your code properly: Using code tags properly

No, this is just a bunch of text. And somewhere you are missing a ; or you have extra } or whatever. We will know when you fix your code and it is somewhat readable.

replace yeild with yield

1 Like

Thank you so much Valijuin, it worked!

I should have seen the spelling error

You should be using a code editor like Visual Studio which reports these issues as soon as you type them.