Trigger doesn't work the first time around?

I’ve set up a trigger such that when a object enters it’s name is shown in the console through Debug.Log statement. While the methods functions perfectly, just after hitting play in the editor, when the object goes through the trigger for the first time, it does not register the gameobject (Nothing shown in the console as the object flies through the trigger for the first time but it works latter. Any ideas as to why that might be the case and how to remedy it?

void OnTriggerEnter (Collider other)
     Debug.Log (;
     \\Does Stuff

If an object spawns in a trigger, the method OnTriggerEnter does not get triggered.
Either make sure you are spawning gameobject outside Trigger zone, or use OnTriggerStay also. But I think it will trigger only when you move.

How quickly is the object moving? I know that you said it constantly doesn’t work the first time and works every other time, but it might be worth a try making the object slower just as an experiment to see if it isn’t being caught in one frame.

However, a solution that I have - something I like to use a lot - is raycasting/linecasting from the moving object. Draw a raycast/linecast from the current object’s position to the position it will be next frame, and check if the cast collides with anything. If it collides, check the “other” tag and see if it matches the trigger’s tag (you will have to set a custom tag), then print something if it did collide.

If you could tell me more info, such as what this is for, the moving object’s size/speed, etc. I could try to help more as I can’t do much with how much I currently know.

If you have more questions please ask, if this solved it please mark the answer as accepted, thank you :slight_smile: