How do I check for trigger collisions upon or immediately after calling the Start() function?

Basically, my game involves using very large trigger colliders to simulate heat (and uses distance from those colliders to simulate the temperature). Very often, I will need to instatiate game objects inside said colliers. Whenever I do this, the object has no temperature until it moves. I’ve figured out the reason why is because Unity hasn’t had a chance to set detect the heat source with OnTriggerEnter().

My current solution is to simply give the game object a really tiny bump in Start():

gameObject.transform.position = gameObject.transform.position + transform.up * 0.0001f;

I feel like there’s a better way to do this though, a better way that doesn’t feel so cheaty, and a way that doesn’t involve using Awake().

Alright, you need to read Trigger Documentation, but in simple term: OnTriggerEnter and OnTriggerExit only fired once UNLESS the object is moving in and out of that very large Trigger Collider you have.

What you want is OnTriggerStay. It basically constantly triggered as long as the object stayed inside your very large Trigger Collider. Note that OnTriggerStay triggered every single frame, and might be faster than even Update().

If your object magically appear on top of the very large Trigger Collider you have then it moving upward faster than your eyes can detect it when the game start. Just decrease the increment for magical animation you seek.

Add random y direction for bubble effect in water :wink: