So I’ve watched lots of tutorials and I have no idea what my problem could be. What I am trying to do is that whenever an object passes over a certain spot on the map, something will happen (a debug.log is what I am using for now). To do this, every object I want to be able to trigger the area, I’ve added a “box collider 2d” without the “is trigger” checkmarked. I then created empty objects at the spots I needed them and added “box collider 2d” to all of them and checked the “is trigger” box. I then wrote a script, and wrote in it:
#pragma strict
function OnTriggerEnter() {
Debug.Log("It worked");
}
I then attached this script to all of the empty objects. When I test to see if this works, nothing happens.
Extra information that might be of use:
- Every object that needs to trigger the empty object is moving using Itween. The script for that is
iTween.MoveTo(gameObject,{"y": Variables.bikeDestination, "easetype": "linear","time": Variables.travelTime });
- I created an empty object with no components attached, and dragged all of my triggers onto it to keep things more organized.