using UnityEngine;
using System.Collections;
public class Beam : MonoBehaviour {
public Transform spwanpoint;
public bool Create = true;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Create == true){
transform.localScale += new Vector3(0, 0, 10);
}else{
}
}
void OnTriggerEnter(Collider other){
if (other.gameObject.CompareTag( "Wall"))
{
Debug.Log("I got hit");
Create = false;
}
}
}
The problem is that the doesn’t call the things in “if (other.gameObject.CompareTag( “Wall”))”.
If I delete that if statement then when a collider enters it works. So I don’t really know what I’m doing wrong.