I am trying to make 2d combat in my game by following this
Brackeys tutorial. I have gotten a couple errors that I cant find a solution to.
I have this in 5 different places: error CS1022: Type or namespace definition, or end-of-file expected
I have this in one place: error CS8124: Tuple must contain at least two elements.
I have this in 2 different places: error CS0116: A namespace cannot directly contain members such as fields or method
I also have an expected β)β even though I have close brackets everywhere
Heres my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerAttack : MonoBehaviour
{
public Transform attackPoint;
public float attackRange = 0.5f;
public LayerMask EnemyLayers;
Animator anim1;
// Start is called before the first frame update
void Start()
{
anim1 = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
//Play an attack animation
if (Input.GetMouseButtonDown(0))
{
anim1.SetTrigger("Attack");
}
//Detect enemies in range of attack
Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, enemyLayers);
//Damage them
foreach (Collider2D enemy in hitEnemies)
{
Debug.Log("we hit" + enemy.name);
}
}
}
void OnDrawGizmosSelected();
}
if (attackPoint == null)
return;
Gizmos.DrawWireSphere(attackPoint.position, attackRange);
}
Thank you for any help!