- Home /
Question by
Tberry · May 25, 2015 at 12:15 PM ·
scripting problemerrorfpsgun
Error CS0103, The name GetComponet does not exist in the current context.
So, I'm making a script for my animation controller to transition from idle to shooting but it's giving me that error and I am not sure why. using UnityEngine; using System.Collections;
public class CZ805Controller : MonoBehaviour {
private Animator anim;
// Use this for initialization
void Start ()
{
anim = GetComponet<Animator> ();
}
// Update is called once per frame
void Update ()
{
if (Input.GetButton ("Fire1"))
{
anim.SetBool ("Shoot", true);
}
else
{
anim.SetBool ("Shoot", false);
}
}
}
Comment
Best Answer
Answer by DoTA_KAMIKADzE · May 25, 2015 at 12:15 PM
You've 1 letter "n" absent:
anim = GetComponent<Animator>();
Ah, something so simple I wouldn't have thought it. Thanks!
Your answer
Follow this Question
Related Questions
How can I shoot bullets that you can aim with the crosshair? 1 Answer
Where is the problem with the script, i want my player to die when his health is <1 1 Answer
No Monobehaviour scripts in files 1 Answer
Why does Unity crash with this code ? 2 Answers
Is there a script out there that actully works for shooting bullets? 2 Answers