error CS1519: Unexpected symbol

This is the code I’m using. I’ve read through it many times, yet cannot find a solution. There are 7 other errors saying the same thing with different symbols. To an untrained eye, I cannot see what’s wrong.

Assets/Scripts/Enemy2D.cs(10,29): error CS1519: Unexpected symbol `(’ in class, struct, or interface member declaration

Assets/Scripts/Enemy2D.cs(10,42): error CS1519: Unexpected symbol `)’ in class, struct, or interface member declaration

Assets/Scripts/Enemy2D.cs(11,45): error CS1519: Unexpected symbol `==’ in class, struct, or interface member declaration

Assets/Scripts/Enemy2D.cs(12,48): error CS1519: Unexpected symbol `(’ in class, struct, or interface member declaration

Assets/Scripts/Enemy2D.cs(12,77): error CS1519: Unexpected symbol `,’ in class, struct, or interface member declaration

Assets/Scripts/Enemy2D.cs(12,117): error CS1519: Unexpected symbol `)’ in class, struct, or interface member declaration

Assets/Scripts/Enemy2D.cs(14,9): error CS8025: Parsing error

using UnityEngine;
using System.Collections;

public class Enemy2D : MonoBehaviour {

	public GameManager gameManager;

	int damageValue = 1;

	void OnTriggerEnter((Collider col)){
		if(collider.gameObject.tag == "Player"){
			gameManager.SendMessage("PlayerDamaged", damageValue, SendMessageOptions.DontRequireReceiver);
		}
	}
}

void OnTriggerEnter(Collider col){ if(col.gameObject.tag == "Player"){

2 Answers

2

void OnTriggerEnter((Collider col)){

should be

void OnTriggerEnter(Collider col){

Thank you! As I said, to an untrained eye it was difficult to spot. I think Mono Develop automatically added brackets. :)

I have the same problem but with symbol ` and I cant find that symbol. This is my script…

using System.Collections
using System.Collections.Generic
using UnityEngine

public class PlayerController : MonoBehaviour {


	void Update()
	{
		transform.Translate (moveSpeed * Input.GetAxis ("Horizontal") * Time.deltaTime, 0f, Input.GetAxis ("Vertical") * Time.deltaTime)
	}

	public delegate speed

	private Rigidbody rb

	void Start ()
	{
		rb = GetComponent<Rigidbody>()

		moveSpeed = 1f
	}

	void FixedUpdate ()
	{
		float moveHorizontal = Input.GetAxis ("Horizontal")
		float moveVertical = Input.GetAxis ("Vertical")

		Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical)

		rb.AddForce (movement * speed)
	}

So you need a semicolon at the end of line 10, 13, 15, 19, 21, 26, 27, 29, 31