Objects not being destroyed
I looked around the forums and keep getting pointers back to the same solution I'm trying.
I'm spawning prefabs (simple cubes w/ box colliders) then applying a transform to them to have them come at the camera like so:
void Update()
{
transform.position += Time.deltaTime * transform.forward * 3;
}
then, when they pass behind the field of view, they hit a mesh assigned with this script:
public class DestroyObjects : MonoBehaviour
{
void OnTriggerExit(Collider other)
{
Destroy(other.gameObject);
}
}
yet they aren't being destroyed. " Is Trigger " is enabled on the mesh with the destroy script.
Any thoughts, or can I provide more information?
Thanks in advance.
Answer by bubbafrye · Mar 04, 2020 at 01:01 AM
Following up on this, I have tried a couple of tests including:
creating a simple scene with two cubes (one trigger and one destroyer) set to a desktop publishing profile (the original project was targeting an Oculus)
removed the movement script from the objects I want to destroy and made them mouse-movable
still not able to destroy anything.
Any thoughts are appreciated. Let me know if there is more information I can provide. Thanks!