It happens when an object is created inside another collision box.
It caught me out for a while.
Never underestimate Unity’s predilection for sloppy instantiation and race conditions!
DD
What about Awake()? Now that one should definitely get called before any OnCollisionEnter() because it’s supposed to be like the constructor.
File ze bug!
Yes, using Awake fixes the problem. Although Unity seems to encourage using Start for some reason.
Unity loves to confuse people!
Unity also encourages using System.Collections rather than System.Collections.Generic which is frankly insane.
Programmers should think of any UT recommendations and documentation as being geared towards artists and other non-coders-moonlighting-as-scripters and take them with a heaping serving of salt.
That said, I’d say that Awake() and OnEnable() getting called immediately and colliders becoming active right away is the proper behaviour here. The problem is the lack of explicit documentation to this effect and the inherent raciness of Unity’s component model that makes such documentation necessary.
Also, this would seem to mean that things can interact on the physics layer before they are rendered, which is necessary and correct with a frame-delayed Start(), but potentially misleading. Well, I don’t think things are rendered before Start() is called, but, yeah… The documentation doesn’t go into specifics like this.