The question is answered, right answer was accepted
Why is my '(' an unexpected symbol?
anim.SetBool("Attacking", attacking); (problem section of script)
I took this code straight from the 2D platformer tutorial on YouTube for melee attacking. The code worked for the guy in the tutorial so I must've made some mistake that I can't identify. What is wrong with my anim.SetBool("Attacking", attacking); section of my script? Unity is telling me that the parenthesis are unexpected symbols and for the life of me I can't understand why.
Thanks!
Here is the rest of the script I forgot to add :)
using UnityEngine; using System.Collections;
public class PlayerAttack : $$anonymous$$onoBehaviour {
private bool attacking = false;
private float attackTimer = 0;
private float attackCd = 0.3f;
public Collider2D attackTrigger;
private Animator anim;
void Awake()
{
anim = gameObject.GetComponent<Animator> ();
attackTrigger.enabled = false;
}
void Update()
{
if (Input.Get$$anonymous$$eyDown ("f") && !attacking)
{
attacking = true;
attackTimer = attackCd;
attackTrigger.enabled = true;
}
if (attacking) {
if (attackTimer > 0)
attackTimer -= Time.deltaTime;
}
else
{
attacking = false;
attackTrigger.enabled = false;
}
}
anim.SetBool("Attacking", attacking);
}
Never $$anonymous$$d! Found the problem. I messed up my curly brackets on my if statements. Sorry for the trouble!