What i do wrong ?
sorry for poor english.
if(Input.GetButtonDown(“Fire1”))
{
var playerRay : RaycastHit ;
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var onhitbar1 = GameObject.FindGameObjectWithTag(“Hit Bar”).GetComponent(HitBar);
if(Physics.Raycast(ray,playerRay))
{
if(onhitbar1.onHitBar1 == true)
{
Debug.Log(playerRay.collider.gameObject.tag);
if(playerRay.collider.gameObject.tag == “Food Bar” )
{
Destroy(GameObject.FindGameObjectWithTag(“Food Coin”));
if ( Destroy(GameObject.FindGameObjectWithTag(“Food Coin”)))
{
FoodPoint = FoodPoint + foP ;
}
onhitbar1.onHitBar1 = false;
score1++;
}
}
}