error even after following simple tutorial
hey guys thank you for readining this i am getting an error CS0103 saying the name tmpC does not exist in current context my code is as below
using UnityEngine; using System.Collections;
public class inputController : MonoBehaviour { private bool isMobile = true; private Playerhandler _player;
// Use this for initialization
void Start () {
if (Application.isEditor)
isMobile = false;
_player = GameObject.Find ("Player").GetComponent<Playerhandler> ();
}
// Update is called once per frame
void Update () {
if (isMobile) {
int tmpC = Input.touchCount;
tpmC --;
if (Input.GetTouch (tmpC).phase == TouchPhase.Began) {
handleInteraction (true);
}
if (Input.GetTouch (tmpC).phase == TouchPhase.Ended) {
handleInteraction (false);
}
} else {
if (Input.GetMouseButtonDown (0)) {
handleInteraction (true);
}
if (Input.GetMouseButtonUp (0)) {
handleInteraction (false);
}
}
}
void handleInteraction(bool starting){
if (starting) {
_player.jump ();
} else {
}
}
}
the link of the tutorial i followed is this one
https://www.youtube.com/watch?v=MlcAJou5lyE
thanks in advance
Answer by Ali-hatem · Mar 27, 2016 at 03:07 PM
tmpC--;
not tpmC --;
thank you ali ...i wrote the script again with tpmC --; still works for some reason
it's one line was wrong int tmpC = Input.touchCount;
& under this line you wrote tpmC --;
Your answer
Follow this Question
Related Questions
Everything in red using Monodevelop, why?? 0 Answers
Error CS0103 : Array name "does not exist" if I initialize it in Start function 1 Answer
compiler error CS0103 The name 'CheckedBox' does not exist in the current context 0 Answers
Error CS 0103 "Debug does not exist in the current context" 0 Answers
error CS0103: The name `renderer' does not exist in the current context 2 Answers