How to understand compiler and other errors and even fix them yourself: https://forum.unity.com/threads/ass...3-syntax-error-expected.1039702/#post-6730855 If you post a code snippet, ALWAYS USE CODE TAGS: How to use code tags: https://forum.unity.com/threads/using-code-tags-properly.143875/ How to report your problem productively in the Unity3D forums: http://plbm.com/?p=220
Im sorry, I'm very new to unity and C# and I've added it and the errors are still there, any fixes. sorry. Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerAttack : MonoBehaviour public Camera cam; public GameObject Hand; public Weapon myWeapon; Animation handAnim; void Start() { handAnim = Hand.GetComponent<Animator>(); myWeapon = Hand.GetComponentInChildren<Weapon>(); } void Update() { if(Input.GetMouseButtonUp(0)) { DoAttack(); } } private void DoAttack() { Ray ray = cam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if(Physics.Raycast(ray , out hit, myWeapon.attackRange)) { if(hit.collider.tag = "Enemy") { EnemyHealth. eHealth = hit.collider.GetComponent<EnemyHealth>(); eHealth.TakeDamage(myWeapon.attackDamage); } } } //end o class ("{"line 6,"}" line 41")
and why you copy and paste ("{" line 6, "}" line 41) on line 41 that is not what spryx want you to do you write: { ,at line 6 and, } at line 41