- Home /
Question by
RVDL_IT · Mar 12, 2018 at 09:58 PM ·
c#if-statementscompiler errorcs0103
Variable not recognized
I'm writing an attack script, but for some reason my SwingTime variable gets CS0103 errors.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AttackControls : MonoBehaviour {
public GameObject Sword;
public float SlingSpeed;
public float SwingTime = 10;
public float STLength;
void Awake () {
SlingSpeed = Time.deltaTime * 100;
}
void Update () {
if(Input.GetKeyDown(KeyCode.R) && SwingTime == 0){
SwingTime = STLength;
}
if(SwingTime > 0){
Sword.transform.Rotate(Vector3.back * SlingSpeed);
Swingtime -= Time.deltaTime; //CS0103 No. 1
}
if(Swingtime < 0){ //CS0103 No. 2
SwingTime = 0;
}
}
}
Comment
Capitalization is wrong, should be capital T (Swingtime should be SwingTime)
Oops, my bad, I converted your comment to an answer too.
Best Answer
Answer by bobisgod234 · Mar 12, 2018 at 10:04 PM
Capitalization is wrong, should be capital T (Swingtime should be SwingTime)