http://answers.unity3d.com/questions/8472/help-with-error-expression-denotes-a-type-where-a.html

Hello i am working on converting this script from java to c# i am almost there i have run into a error for which i cant find a solution.

from what i can see it looks correct but it is clearly not can anyone shed some light on the subject.

this is the error i get.

Assets/Scripts/RayCastChop.cs(21,115): error CS0119: Expression denotes a type', where a variable’, value' or method group’ was expected

treeScript = GameObject.Find(hit.collider.gameObject.name).GetComponent(TreeCont);
is the line that is giving me problems.

The original script can be found in this video as mentioned it was originally written in javascript. I have been told it is not good to mix languages and because i have started writing my game in c# i want to stick to c# and not cross languages.

using UnityEngine; using System.Collections;
public class RayCastChop : MonoBehaviour {


	int rayLength = 10;

	private TreeCont treeScript;
	private PlayerControls playerAnim;
	public Vector3 fwd;
	void  Update (){

		RaycastHit hit;
		fwd = transform.TransformDirection(Vector3. forward);

		if(Physics.Raycast(transform.position, fwd, hit, rayLength)) 
		{
			if(hit.collider.gameObject.tag == "Tree")
			{
				treeScript = GameObject.Find(hit.collider.gameObject.name).GetComponent<TreeCont>(TreeCont);
				//playerAnim = GameObject.Find ("Human_Model@Idle").GetComponent (PlayerControls);		
				if (Input.GetMouseButtonDown(0)) 
				{
					treeScript.treeHealth -= 1;
				}

			}
		}
	}
}

This…

treeScript = GameObject.Find(hit.collider.gameObject.name).GetComponent<TreeCont>(TreeCont);

Should be…

treeScript = GameObject.Find(hit.collider.gameObject.name).GetComponent<TreeCont>();