Multiplayer FPS EP6 Error CS1525

Updated on December 8, 2017 in General
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
3 on November 28, 2017

I’m fairly new to unity and C# and I was just wondering if anyone could help with this error? The bold text is where the error is originating form..

 

 

 

Assets/Scripts/PlayerShoot.cs(17,3): error CS1525: Unexpected symbol `this’

 

 

 

 

 

 

 

using UnityEngine.Networking;
using UnityEngine;

 

 

 

public class PlayerShoot : NetworkBehaviour {

 

 

 

public PlayerWeapon weapon;

 

 

 

[SerializeField]
private Camera cam;

 

 

 

[SerializeField]
private LayerMask mask;

 

 

 

void Start(){
if (cam == null) {
Debug.LogError (“PlayerShoot: No Camera Referenced”)
this.enabled = false;
}
}

 

 

 

void Update (){
if (Input.GetButtonDown (“Fire1”)) {
Shoot ();
}
}

 

 

 

void Shoot (){
RaycastHit _hit;
if (Physics.Raycast(cam.transform.position, cam.transform.forward, out _hit, weapon.range, mask)) {
Debug.Log (“We Hit ” = _hit.collider.name);
}
}
}

 

 

 

  • Liked by
Reply
0 on December 2, 2017

Bump.

  • Liked by
Reply
Cancel
1 on December 6, 2017

Let’s read the error message the compiler gives us: unexpected symbol “this”?
In other words: I recognize that you are telling me “this”, but I was expecting something else. Typically, this means something went wrong prior to the reported line.

It’s a missing semicolon on the preceding line.

on December 8, 2017

I cant believe I missed that… Thank you!

Show more replies
  • Liked by
Reply
Cancel