i have those options right now and the only options i need is ray lenght the rest are things that i dont need how do i remove them but still let my scripts work?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class rayCastTree : MonoBehaviour {
public float rayLenght = 10;
public treeController treeScript;
public RaycastHit hit;
public Transform fwd;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
int rayLength = 10;
var fwd = transform.TransformDirection(Vector3.forward);
if(Physics.Raycast(transform.position, fwd, out hit, rayLength))
{
if (hit.collider.gameObject.tag == "Tree")
{
treeScript = GameObject.Find(hit.collider.gameObject.name).GetComponent<treeController>();
if (Input.GetButtonDown("Fire1"))
{
treeScript.treeHealth -= 1;
}
}
}
}
}
